Hello Rodolfo,
I am trying to upload multiple images from my mobile app to the server with cordova plugin file transfer.
It is working with single image upload, but when I try to upload multiple images at once (in a for loop), the server saves the last selected image and respond with --> http_status : 400 , "message”: "Duplicated upload”
Below is my code:
Any solution to this? Thanks
I am trying to upload multiple images from my mobile app to the server with cordova plugin file transfer.
It is working with single image upload, but when I try to upload multiple images at once (in a for loop), the server saves the last selected image and respond with --> http_status : 400 , "message”: "Duplicated upload”
Below is my code:
Code:
$scope.uploadImages = function () {
var success = function (response) {
console.dir(JSON.stringify(response));
};
var fail = function (error) {
console.dir(JSON.stringify(error));
};
for (var i = 0; i < $scope.images.length; i++) {
var options = new FileUploadOptions();
options.fileKey = "source";
options.mimeType = "image/png";
var uploader = new FileTransfer();
console.log("Uploading :" + $scope.images[i]);
uploader.upload($scope.images[i], encodeURI(REQUEST_URL + "?key=" + CHEVERETO_API_KEY), success, fail, options);
};
};
Any solution to this? Thanks