Gop*_*opi 7 html internet-explorer-11 microsoft-edge
"change .btn-file :file" : "getfileinfo",
getfileinfo: function(e){
var fileInput = document.getElementById('fileupload');
var file = fileInput.files[0];
if(!file || (file.type != 'text/plain' && file.type != 'text/csv' && file.type != 'application/csv' && file.type != 'application/vnd.ms-excel' && file.type != 'text/csv')){
$('.alert-file').show();
$('.alert-file').delay(4000).fadeOut('slow');
return false;
}
var reader = new FileReader();
reader.onload = function(e) {
$('#fileData').val(reader.result);
$('#fileName').val(file.name);
};
reader.readAsDataURL(file);
}
Run Code Online (Sandbox Code Playgroud)
file.type如果我在IE11和IE Edge中使用,则为null.所有其他浏览器工作正常.
有人可以帮我吗?
测试用例
<input type="file" onchange="document.body.innerText = this.files[0].type" />Run Code Online (Sandbox Code Playgroud)
对于SVG,PNG,ZIP返回MIME,但""对于PDF 返回
在Windows 8.1 Pro x64下的IE11上复制
Version: 11.0.9600.18053
Update Versions: 11.0.24 (KB3093983)
Run Code Online (Sandbox Code Playgroud)
错误已报告,并通过“无法复制” https://connect.microsoft.com/IE/Feedback/Details/2009205关闭。它提到了为什么IE团队无法复制:
请记住,只有在系统上安装了该MIME类型的处理程序应用程序(例如Adobe Reader)并在注册表的HKEY_CLASSES_ROOT注册表配置单元内创建映射时,IE才能根据文件的扩展名确定文件的MIME类型。如果注册表中没有映射,则IE无法知道文件的MIME类型。
在20 GB的新安装Windows中,没有空间放置file工具