【发布时间】:2015-03-12 07:48:24
【问题描述】:
在 chrome 上上传 csv 文件时,我没有得到任何类型(在上传 .pdf、.jpg 等其他文件时,我得到了他们的类型)。此问题仅在 Window 的 chrome 浏览器中出现。在其他浏览器和操作系统中它工作正常。我正在使用最新的 chrome 版本,示例代码是:
<!DOCTYPE html>
<html>
<body onload="myFunction()">
<input type="file" id="myFile" onchange="myFunction()">
<p id="demo"></p>
<script>
function myFunction(){
var x = document.getElementById("myFile");
var type = x.files[0].type;
document.getElementById("demo").innerHTML = 'TYPE : '+type;
}
</script>
</body>
</html>
我的 Plunker 示例是 here
【问题讨论】:
标签: html google-chrome file-upload