You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "David Song (JIRA)" <ji...@apache.org> on 2015/11/17 01:37:11 UTC

[jira] [Updated] (CB-10019) window.resolveLocalFileSystemURL() callback not working

     [ https://issues.apache.org/jira/browse/CB-10019?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Song updated CB-10019:
----------------------------
    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!

{code:JavaScript}
       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);
      });
{code}

  was:
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!

Code:

       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);
      });



> window.resolveLocalFileSystemURL() callback not working
> -------------------------------------------------------
>
>                 Key: CB-10019
>                 URL: https://issues.apache.org/jira/browse/CB-10019
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin File
>         Environment: Android
>            Reporter: David Song
>              Labels: camera, file, image, plugin, plugin-file, resolveLocalFileSystemURL
>
> 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!
> {code:JavaScript}
>        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);
>       });
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org