4
我需要获取加载文件才能输入。 此代码在Chrome,Opera和Firefox,但不与IE:如何在IE上获取文件输入更改
$("input:file").change(function()
{
// Get a reference to the fileList
var files = !!this.files ? this.files : [];
// If no files were selected, or no FileReader support, return
if (!files.length || !window.FileReader) return;
// Only proceed if the selected file is an text
if (/^text/.test(files[0].type))
{
var reader = new FileReader();
reader.readAsText(files[0]);
reader.onloadend = function()
{
restoreCSS(this.result);
}
}
}
在IE !!this.files
返回false。感谢您的提前。
我有9个或更高版本。 9如何解决这个问题? – Andrew
@Andrew:[在IE 9中FileReader()的Shim](http://stackoverflow.com/questions/11089897/shim-for-filereader-in-ie-9) – apsillers
感谢您的解释。此问题已关闭。 – Andrew