我正在使用codeigniter和jQuery表单插件。
我正在尝试上传文件,但它无法使用IE浏览器。
请检查我的控制器:
if($fileCount >0)
{
//there are some files
//configure upload
$config['upload_path'] = 'crm_data/crm_customer_data';
$config['allowed_types'] = 'zip|rar|doc|pdf|gif|jpg|jpeg|docx';
$config["max_size"] = 2048;
$config['encrypt_name'] = true;
//loading upload
$this->load->library("upload");
$this->upload->initialize($config);
if($this->upload->do_upload("attach"))
{
$l = $this->upload->data();
$logs["attachment"] = $l["file_name"];
}
else
{
//some errors on upload exit(json_encode(array("status"=>FALSE,"reason"=>$this->upload->display_errors())));
}
这是html
<input type="file" id="attach" name="attach" />
除了IE之外,其他浏览器的确如此。
看到回复。
var_dump($_FILES)
array
'attach' =>
array
'name' => string 'invoice_record_and_list.zip' (length=31)
'type' => string '' (length=0)
'tmp_name' => string 'C:\wamp\tmp\phpF467.tmp' (length=23)
'error' => int 0
'size' => int 1467474
在IE中我收到以下错误。
不允许您尝试上传的文件类型。
编辑:
我注意到IE上的var_dump为""
提供了type
但在FF中我获得了'type' => string 'application/x-zip-compressed' (length=28)
答案 0 :(得分:1)
这可能会有所帮助。
IE不会为'zip'发送你的mime类型(例如:'type' => string
)。
所以只需在config / memi.ph中附加一个像这样的文件类型的空值。
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed',"")