I can not get file size

0

I have the following problem in my code it can not get into the function to get the size of the file, I'm 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'm trying to get the file size but it does not go into the function, it does not show anything, does anyone know to tell me the problem or am doing it wrong.

    
asked by anonymous 08.01.2018 / 20:05

2 answers

0

Try to put file.files[0].size instead of file.size

    
08.01.2018 / 20:18
0

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

    
08.01.2018 / 20:57