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
Post a Comment