0

I want to be able to preview an image for a user before they upload it.

I've of course discovered that all the modern browsers obscure the actual full path in one way or another, so my original plan of just setting an <img /> element with the local path is out of the question.

I've found this solution, which isn't bad, but I'm expecting the images to be a little bit large, and my users' internet connections to perhaps be a little slow, so this isn't exactly ideal.

I've found that FireFox has the getAsDataURL() method, which would work perfectly if there was some form of it in the other browsers, or at least even IE, but I haven't been able to find it.

Is there any other way to do this and have it work in IE7/8 (6 is a bonus but I don't care that much), FF2/3, and webkit without resorting to a plugin?

1
  • 2
    No, there isn't, except maybe with Flash. Commented Apr 14, 2010 at 21:23

1 Answer 1

1

The answers to the question you have linked tell the truth: There is no way to read files from the user's file system using JavaScript. You will need to upload the image before you can append it to your page as an <img>.

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

2 Comments

@SLaks: The last line of the question explicitly asks for a solution that works in Internet Explorer 7 and 8. I guess that rules HTML 5 out :(
well, crap :\ was hoping there was something I wasn't finding.

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.