I can’t get the file size

Asked

Viewed 13 times

0

Personal I am with the following problem in my code it fails to enter the function to get the file size, I am using Phonegap for development, follow the code below

function onSuccess(imageData) {
  window.resolveLocalFileSystemURL(imageData, function (fileEntry) {
        fileEntry.file(function (file) {
            if (file.size > 2097152) {
                alert("não pode ser maior que 2mb");
            } else {
             //aqui vai o codigo para mostrar a imagem   

            }
        }, function (evt) {

        });
    },
    function () {

    });
   }

So I am trying to get you the file size but it does not enter the function , shows nothing, someone knows tell me the problem or I am doing wrong.

2 answers

0

Try to put file.files[0].size in place of file.size

  • Because it is neither enough nor enter if, it does not enter the fileEntry.file(Function (file) function nor the Function (fileEntry) { as if it did not recognize it

  • I debugged here and changed the line file(function (file) { for files(function (file) { and did not accuse more errors.

  • Yeah, I’ll try it this way

  • Did not work, does not enter the Function function (fileEntry) {

0

I was able to solve the problem with file://'+imagedata and the path was correct

Browser other questions tagged

You are not signed in. Login or sign up in order to post.