Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-10019

window.resolveLocalFileSystemURL() callback not working

    Details

      Description

      I'm using ngcordova camera and trying to upload the image to google drive. Testing on android with ionic view and jsconsole.com for viewing logs.

      For my code, the only log output I get is 'got uri file:///storage/emulated/0/Android/data/com.ionic.viewapp/cache/1447714232041.jpg' and nothing else such as 'trying to read file' inside the resolveLocalFileSystemURL function.

      I've seen previous issues such as https://issues.apache.org/jira/browse/CB-6116 but is there anything wrong with my image file path? Any help would be greatly appreciated!

             var options = {
                     quality: 75,
                     destinationType: Camera.DestinationType.FILE_URI,
                     encodingType: Camera.EncodingType.JPEG,
                     correctOrientation: true,
                     saveToPhotoAlbum: false
                   };
              
             $cordovaCamera.getPicture(options).then(function(uri) {
      
              console.log('got uri ' + uri);
              window.resolveLocalFileSystemURL(uri, function(fileEntry) {
      
                console.log('trying to read file');
                fileEntry.file(function(file) {
                  
                  console.log('file read');
                  // (MediaUploader is this https://github.com/googledrive/cors-upload-sample)
                  var uploader = new MediaUploader({
                    file: file,
                    token: access_token,
                    onComplete: function(res) {
                      console.log("Upload successful " + res);
                    },
                    onError: function(res) {
                      console.log('Upload not successful ' + res);
                    },
                  });
                  uploader.upload();
      
                }, function(err) {
                  console.log(err);
                });
              }, function(err) {
                console.log(err);
              });
            }, function(err) {
              console.log(err);
            });
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dsongx@gmail.com David Song
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: