FileReader() API not working for PDF,Excel, Doc format but Working for image format

Viewed 26

I used cordova for my application, I want to read all type of file format (ex:image,xls,pdf and etc), for uploading but filereader's working only for image format not for other formats, Do we have any option to allows formats

e.target.result - will come with null value from filreader

sample code:

              let reader = new FileReader();
             
              entry.file(function (file) {
                  reader.onloadend = function (e) {
                    var content = e.target.result; // null value when choose .xml,pdf
                   console.log(content)
                  };

                  reader.readAsDataURL(file);
                });

0 Answers
Related