【发布时间】:2023-04-07 22:08:01
【问题描述】:
我正在使用 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 给了我一个 "" for type但在 FF 我得到了'type' => string 'application/x-zip-compressed' (length=28)
【问题讨论】:
标签: php codeigniter internet-explorer file-upload