用户
 找回密码
 入住 CI 中国社区
搜索
查看: 980|回复: 1
收起左侧

[HELP] uploadify图片批量上传报错,求教

[复制链接]
发表于 2016-4-7 16:05:35 | 显示全部楼层 |阅读模式
使用uploadify或webuploader插件上传图片时候都提示You did not select a file to upload
controller如下
    public function do_upload()
    {
        $config['upload_path']   = 'uploads';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size']      = 10000000;
        $config['encrypt_name']  = 'true';

        $this->load->library('upload', $config);
        header('Content-Type: application/json; charset=utf-8');
        header("HTTP/1.1 200 OK");
        
        if ( ! $this->upload->do_upload('file_upload'))
        {
            $error = array('error' => $this->upload->display_errors());

                echo json_encode(array('error'=> $error));
        }
        else
        {
            $data = array('upload_data' => $this->upload->data());

            echo json_encode(array('data'=> $data));
        }
    }
网上提示 $this->upload->do_upload('file_upload') 与<input type="file" name="file_upload" id="file_upload">名称要一致
config/mimes.php 里'jpeg'        =>        array('image/jpeg', 'image/pjpeg')要加上 'application/octet-stream'
加完均无效果,求教各位大大有没遇到此等问题,CI用的2.1

本版积分规则