Reputation: 83
Im using jquery with cordova to build an app , on android everything works like a charm , but on ios the uploading is not working using filetransfer plugin .
this is the function i use to upload the picture that the user select already using the file plugin :
function uploadFile() {
var fileURI = $("#selectedPicture").attr("src");
var options = new FileUploadOptions();
options.fileKey = "file";
options.mimeType = "image/jpeg";
options.fileName = fileURI.substr(fileURI.lastIndexOf('/') + 1);
var params = new Object();
options.params = params;
options.chunkedMode = false;
var ft = new FileTransfer();
ft.upload(fileURI, serviceURL+"uploadFile",function(r){
alert(r.response);
}, fail,
options);
}
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);
}
on the console i don't get any error or message .
i added those to lines on my infoplist file :
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
PS 1 : i use ios 9.2
PS 2 : i use cordova 6 .
PS 3 : the normal ajax works great only the upload thats not working .
PS 4 : i test the code using the latest ios simulator .
Upvotes: 0
Views: 815
Reputation: 83
the problem was from the image size i tried to upload . i just selected an other image and i got what i was looking for .
Upvotes: 1