我试图在上传之前显示图像预览,因为我正在使用下面给出的代码..
它适用于 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;
}
我需要帮助.. 有没有办法在IE8等浏览器中预览图像?
最佳答案
我知道的唯一方法是使用 Flash 影片上传。对于一个很好的例子,请参阅 here .
关于javascript - 上传前预览图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5594099/