问题
How come IE 9 does not support input type="file" multiple
like other browsers do?
<form action="#" method="post" enctype="multipart/form-data">
<input type="file" multiple name="uploads[]" />
<input type="submit"/>
</form>
How can I make it work on IE?
回答1:
Uploading multiple files is a specific part of HTML5 that none of the Internet Explorers support.
回答2:
IE should support multiple according to this doc:
http://msdn.microsoft.com/en-us/library/ie/hh772307(v=vs.85).aspx
But even so, their own example does not work with IE9 for me..
<input type="file" multiple="multiple" onchange="for (var i = 0; i < this.files.length; i++) { document.write(this.files[i].name ) };" />
When the onchange event fires, the files property doesn't appear to exist for the HTMLInputElement in IE, whereas in Chrome it does.
Update: this doc apparently doesn't apply to IE9. IE 10 is said to support the File API. Let's hope it will be released soon.
回答3:
You may use button that create additional inputs in IE.
It will work same as multiple input in other browsers(for your server).
Sure, users will should select every file one by one, but they use IE
回答4:
I got it fixed by adding below metadata at the top of page after "Title" tag.
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
"IE=Edge" loads the latest version of IE version.
来源:https://stackoverflow.com/questions/7085171/ie-input-type-file-multiple