0

列出的其他文件上传正常,但 swf 文件未上传并且不支持文件类型错误。

这是我的控制器

function do_upload(){
    $pid=$this->input->post('Page_id');
    $config['upload_path'] = './uploads/';
    $config['allowed_types'] = 'swf|png|gif|jpg';
    $config['max_size'] = '1048';
    $config['file_name'] =$pid;
    $this->load->library('upload', $config);

    if ( ! $this->upload->do_upload())
    {
        $error = array('error' => $this->upload->display_errors());

        $this->load->view('admin/upload', $error);
    }
    else
    {
        $data = array('upload_data' => $this->upload->data());

        $this->upload_success();
    }
}
4

2 回答 2

0

可能是 _file_mime_type 函数中的文件上传类的 look for more 错误

于 2013-06-24T10:14:56.083 回答
0

您没有在do_upload调用中传递字段名称,例如

  $config = array(
        'allowed_types' => 'jpg|jpeg|swf|png', // pipe seperated file types
        'upload_path' => './uploads/',// should be the root path
        'max_size' => '1048',
        'file_name' =>$pid
        );
$this->load->library('upload', $config );

if (!$this->upload->do_upload('your_field_name')){  
// like  $this->upload->do_upload($pid)
 $error = array('error' => $this->upload->display_errors());

 }else{
 $swf_data = $this->upload->data(); 
  }

希望有意义

于 2013-06-24T10:22:58.637 回答