javascript - 上传前的图片预览 [英] javascript - image preview before upload
本文介绍了javascript - 上传前的图片预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
iam尝试在上传前显示图片预览,因为我使用下面给出的代码..
iam trying to show image preview before upload, for that i am using code given below..
它适用于firefox,但是,使用IE8
it works with firefox, but, dosent work with IE8
<%= image_tag @image, :id=>"preview-photo" %>
<%= file_field 'image','photo', :onchange => "preview(this);" %>
function preview(this) {
document.getElementById("preview-photo").src =this.value;
return;
}
我需要帮助..
有什么解决方案可以预览IE8和其他浏览器中的图像?
i need help.. Is there any solution to preview the image in IE8 and other browsers?
推荐答案
我所知道的唯一方法是使用flash电影进行上传。有一个很好的例子,请参阅这里。
The only way I know of is using a flash movie for your upload. For a nice example see here.
这篇关于javascript - 上传前的图片预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文