2

Is it possible to preview image (on upload) before saving across all the browsers. I have implemented this way for Firefox:

document.getElementById("preview-photo").src = what.files[0].getAsDataURL();

this works fine, and, for IE

document.getElementById("preview-photo").src = what.value;

this docent work and same case with other browsers like Chrome and Safari. Currently I can see preview only in Firefox, other browsers not showing preview.

Please, advise me how to work on this.

Thanks

jtbandes
  • 115,675
  • 35
  • 233
  • 266
lamrin
  • 1,431
  • 4
  • 22
  • 34

1 Answers1

0

There's no completely cross-browser way to do this due to security settings in most browsers preventing file control access.

This may indicate a work-around for FF3, IE7, and a handful of other cases:

How to upload preview image before upload through JavaScript

Community
  • 1
  • 1
Winfield
  • 18,985
  • 3
  • 52
  • 65