IE8 - 输入(类型=“文件”)获取文件 [英] IE8 - input (type="file") get files
问题描述
我在Internet Explorer中输入(type =file)方面存在问题(我只在8中测试过)。
HTML
< input id =drop-file-filesclass =drop-file-waitingtype =file>
JS(http://code.jquery.com/jquery-latest.min.js)
$('#drop-file-files')。change(function(e){
$ .each e.target.files,函数(索引,文件){
alert(file);
});
});
它在Firefox,Chrome和Safari返回Object File中工作完美,但IE返回一个错误,因为files 在e.target中是未定义的。有人知道如何使用JavaScript获取这些文件?
编辑:文档 MSDN input type = file - 仅在IE10中文件属性
Internet Explorer 8不支持多个文件。这已经已经在这里讨论。您至少可以通过 e.target.value
获取文件名。
I have a problem with input (type="file") in Internet Explorer (I have tested only in 8).
HTML
<input id="drop-file-files" class="drop-file-waiting" type="file">
JS (http://code.jquery.com/jquery-latest.min.js)
$('#drop-file-files').change(function(e){
$.each(e.target.files, function(index, file){
alert(file);
});
});
It work perfect in Firefox, Chrome and Safari return Object File, but IE return a error because "files" in e.target is undefined. Someone know how can I get this "files" using JavaScript?
EDITED: Documentation MSDN input type=file - Only in IE10 files property
Internet Explorer 8 does not support multiple files. This has been already discussed here. You can at least get the filename via e.target.value
.
这篇关于IE8 - 输入(类型=“文件”)获取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!