window.resolveLocalFileSystemURL callback not called

Currently I’m developing one app that allow user to choose photo from library then upload it to the server, but when I use the below code nothing output in the console.

var options = {
      quality : 20,
      sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
      destinationType: Camera.DestinationType.FILE_URI,
      allowEdit : false,
      encodingType: Camera.EncodingType.JPEG,
      targetWidth: 625, //Damir sa 600
      targetHeight: 800, //Damir sa 600
      saveToPhotoAlbum: false,
      correctOrientation: true
    };
    Camera.getPicture(options).then((imageData) => {
      this.cameraUrl = imageData;
      this.photoSelected = true;
      this.photoTaken = false;

      window.resolveLocalFileSystemURL(this.cameraUrl, function(fileEntry) {
          fileEntry.file(function (file) {
            var reader = new FileReader();

            reader.onloadend = function (e) {
              console.log("file loadend");

	      //Here I want to get the FileEntry and call the upload function
            };
            reader.readAsArrayBuffer(file);                      
          });
      }, function(err) {
          console.log("failed to read the file" + err);
        });

    }, (err) => {
      // Handle error
    });

I already install cordova-plugin-file and its version is 4.3.1.

I’m stuck in here for a few days, any help would be appreciated.

1 Like

Hi, you can try something like this

          File.resolveLocalFilesystemUrl(path) 
          .then(fileEntry => {
            console.log("####", fileEntry);
            
          })
          .catch(err=>{
            console.log("Err", err);
          });
1 Like

Hi Philem,

I tried using File.resolve but it seems is not working. It is not also calling back. I already import the file plugin.