wymsee / cordova-imagePicker

Cordova Plugin For Multiple Image Selection
MIT License
407 stars 857 forks source link

Anyone has same problem as me when uploading using ft.upload? #76

Open clarklight opened 9 years ago

clarklight commented 9 years ago

I am having problem when combing this script with file-transfer for upload.

I have this weird problem, when i am using LG G3, each image can not exceed 700kb, otherwise it will call error_code 1(File not found) from the upload script. When i am using Samsung Note2 each image can not exceed 1.2mb. When i am using Single image upload script before, i have no problem, when i combined this multi-image picker with the Cordova file-transfer. then the problem appeared.

I am not sure what is limiting the amount, not sure if its the HARD_CACHE_CAPACITY or the MAX_Buffer_size

But i am basically just looping through the upload script with each image.

          function selectimages() {  
     window.imagePicker.getPictures(
  function(results) {
    for (var i = 0; i < results.length; i++) {
     alert(results[i]);

        var imageURI = results[i]; 

var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1);
options.mimeType = "image/jpeg";
var params = new Object();
options.params = params;
options.chunkedMode = false;
var ft = new FileTransfer();

ft.upload(imageURI, "http://test.com/setImage", win, fail,
    options);

    function win(r) {

alert("Response = " + r.response);

}

 function fail(error) {
alert("An error has occurred: Code = " + error.code);
alert("upload error source " + error.source);
alert("upload error target " + error.target);

}

    }
 }, function (error) {
    console.log('Error: ' + error);
   }
);
               }
clarklight commented 9 years ago

I had been continuing to dig into the problem, i tested the Multi-image upload script but replacing the URI with static Native image URI, and it uploads with no problem. So i assume the problem occur when the Native URI is replaced with the temp URI.

kzaimov commented 9 years ago

Same problem here. Resolved it by using the imagePicker-ex, but that's not a real solution.

Silvercast commented 8 years ago

+1