简体   繁体   English

javascript - 上传前的图片预览

[英]javascript - image preview before upload

iam trying to show image preview before upload, for that i am using code given below.. 我试图在上传之前显示图像预览,因为我使用下面给出的代码..

it works with firefox, but, dosent work with IE8 它适用于Firefox,但是,它与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;
}

i need help.. Is there any solution to preview the image in IE8 and other browsers? 我需要帮助..有没有解决方案在IE8和其他浏览器中预览图像?

The only way I know of is using a flash movie for your upload. 我知道的唯一方法就是使用flash电影进行上传。 For a nice example see here . 有一个很好的例子,请看这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM