Php IE中codeigniter中的文件上载:不允许尝试上载的文件类型
我正在使用codeigniter和jQuery表单插件 我正试图上传一个文件,但它不能与IE一起工作 请检查我的控制器:Php IE中codeigniter中的文件上载:不允许尝试上载的文件类型,php,codeigniter,internet-explorer,file-upload,Php,Codeigniter,Internet Explorer,File Upload,我正在使用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|d
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中,我得到以下错误
不允许您尝试上载的文件类型
编辑:
我注意到IE上的变量dump给了我一个类型的,
,但在FF中我得到了'type'=>字符串'application/x-zip-compressed'(长度=28)
,这可能会有所帮助
IE不发送“zip”的mime类型(例如:'type'=>string
)。
所以,只需在config/memi.ph中添加一个空值和如下文件类型
'zip'=>数组('application/x-zip','application/zip','application/x-zip-compressed','')
这可能会有所帮助
IE不发送“zip”的mime类型(例如:'type'=>string
)。
所以,只需在config/memi.ph中添加一个空值和如下文件类型
'zip'=>数组('application/x-zip','application/zip','application/x-zip-compressed','')
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