Шукати в статтях підтримки

Остерігайтеся нападів зловмисників. Mozilla ніколи не просить вас зателефонувати, надіслати номер телефону у повідомленні або поділитися з кимось особистими даними. Будь ласка, повідомте про підозрілі дії за допомогою меню “Повідомити про зловживання”

Докладніше

Ця тема перенесена в архів. Якщо вам потрібна допомога, запитайте.

A error: files.item(0).getAsDataURL is not a function .

  • 2 відповіді
  • 85 мають цю проблему
  • 16 переглядів
  • Остання відповідь від cnuvasu

more options

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.

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.

Усі відповіді (2)

more options

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

more options

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; } } } }