问题
In most browsers, an input type="file" has the following files property:
document.getElementById("my-input").files
This can be used to detect a file is uploaded, and get the file. However, it looks like the files attribute doesn't exist in IE9.
Added:
In jQuery, you can do...
$("#my-input").val()
to read the file name. What about getting the files contents?
回答1:
Use jQuery and this plugin.
来源:https://stackoverflow.com/questions/6191792/javascript-file-upload