0

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

<%= 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?

3
  • 1
    This is no longer possible across browsers for security reasons (they serve C:\Fakepath instead of the real value when querying a file upload field). I do not think there is a workaround. Commented Apr 8, 2011 at 11:00
  • any other approach to do this functionality...using any plugins??? Commented Apr 8, 2011 at 11:05
  • Flash based uploaders can theoretically still do this, although I don't know any specific product that does it out of the box. Commented Apr 8, 2011 at 11:08

1 Answer 1

2

The only way I know of is using a flash movie for your upload. For a nice example see here.

Sign up to request clarification or add additional context in comments.

1 Comment

Nice link. This is the best way to go I think

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.