In which environment are you testing this?
What platform, iOS or Android?
Are you receiving an error? If not what’s happening?
Have you tried debugging this app?
// !! Assumes variable fileURL contains a valid URL to a text file on the device,
// for example, cdvfile://localhost/persistent/path/to/file.txt
var win = function (r) {
console.log("Code = " + r.responseCode);
console.log("Response = " + r.response);
console.log("Sent = " + r.bytesSent);
}
var fail = function (error) {
alert("An error has occurred: Code = " + error.code);
console.log("upload error source " + error.source);
console.log("upload error target " + error.target);
}
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1);
options.mimeType = "text/plain";
var params = {};
params.value1 = "test";
params.value2 = "param";
options.params = params;
var ft = new FileTransfer();
ft.upload(fileURL, encodeURI("http://some.server.com/upload.php"), win, fail, options);
Please modify upload error callback, maybe will see more information.
On the other hand, how many console log outputs are you receiving? Don’t tell me its five successful uploads?
What OS are you using on your server side? Have you tried using Fiddler (or any other similar application) to monitor data transfer between your emulator and server?
Is it works? I have this case too, only last image uploaded to server, even I tried to upload it one by one (I’m using alert to stop another loop) but it seems only last image that success
A little late to the party but I did something similar and used the Async Javascript library to push each upload task to a queue and handle them one by one (or however many you want to process in parallel). If I remember correctly, the (mobile) browsers have an issue with handle many/multiple uploads simultaneously. Anyway with the asyc queue it works just fine.