2012-05-24 105 views
1

工作我不能有下面的代码在IE工作。它在Firefox和Chrome上运行良好。JavaScript文件输入不在IE

任何人都可以帮忙,怎么可以对IE此功能工作?

function readURL(input) { 
    if (input.files && input.files[0]) { 
    var reader = new FileReader(); 

    reader.onload = function (e) { 
     $('#img_prev') 
       .attr('src', e.target.result) 
       .width(160) 
       .height(152); 
    }; 

    reader.readAsDataURL(input.files[0]); 
    } 
} 
+0

什么版本的IE? –

+0

它不适用于任何功能。 – seUser

回答

2

我以前有类似的问题。 FileReader尚未支持IE:

http://html5demos.com/

您可能需要如果IE浏览器的支持,需要包括一个普通文件上传到返工您的解决方案。

+0

有没有其他方法可以使此功能起作用? – seUser

+0

可以将其闪存或上传到您的服务器。 http://html5demos.com/file-api-simple –

+0

不为拖放文件,我们结束了一个flash文件上传http://www.easyalgo.com/eaflashupload.aspx它不支持拖放去下降,但仍是一个干净的解决方案。 – ContextSwitch