shugong 发表于 2016-4-7 16:05:35

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

使用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

shugong 发表于 2016-4-7 17:53:09

自顶一下{:1_1:}
页: [1]
查看完整版本: uploadify图片批量上传报错,求教