A error: files.item(0).getAsDataURL is not a function .
getAsDataURL is a javascript ,It ‘s show a picture. In firefox 6,It's ok,but in firefox 7 ,have a error: files.item(0).getAsDataURL is not a function . who can help me ? thanks.
All Replies (2)
The documentation says: The File interface's non-standard methods getAsBinary(), getAsDataURL(), and getAsText() have been removed as well as the non-standard properties fileName and fileSize. See:
https://developer.mozilla.org/en/Firefox_7_for_developers#DOM
https://developer.mozilla.org/en/DOM/File
image preview working for me please find code......
var reader = new FileReader();
function preview(what) { if(jQuery.browser.msie || jQuery.browser.safari || jQuery.browser.chrome) { document.getElementById("preview-photo").src=what.value; return; } else{ // array with acceptable file types var accept = ["image/png","image/jpeg","image/jpg","image/gif"];
// if we accept the first selected file type if (accept.indexOf(what.files[0].type) > -1) { if(what.files && what.files[0]){ reader.readAsDataURL(what.files[0]); document.getElementById("preview-photo").src=reader.result; } } } }