javascript - Show image before actually uploading it -


i'm using filefield upload image server on form , works fine.

but can somehow after user uses browse button load image image field (kind of preview) ? since have no access real full path, didn't find way that...

edit: shayan managed proper code this:

(in fileupload componentes change event):

    var file = uploader.fileinputel.dom.files[0];     var reader = new filereader();     reader.addeventlistener('load', function(evt) {         form.down('#imglogo').setsrc(evt.target.result);     });     reader.readasdataurl(file); 

you should use filereader api , it...

    <script>     var file=new filereader(); file.readasdataurl(fileinput.files[0]); file.onload=function(evt){ var img=document.getelementbyid("myimage"); img.src=evt.target.result; }       </script> 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -