I have a jqm+phonegap application running on cordova 2.9.0 for ios platform. I am sure that i have the correct cordova file on xcode.
On android, my code worked perfectly, but on ios however, my upload image code does not work
JS:
document.addEventListener("deviceready", onDeviceReady, false);
// PhoneGap is ready
function onDeviceReady() {
// Do cool things here...
}
function getImage() {
// Retrieve image file location from specified source
navigator.camera.getPicture(uploadPhoto, function(message) {
alert('Get Picture Failed. Please Try Again.');
},{
quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
}
);
}
function uploadPhoto(imageURI) {
var options = new FileUploadOptions();
options.fileKey="file";
options.fileName=curClub+imageURI.substr(imageURI.lastIndexOf('/')+1);
options.mimeType="image/jpeg";
var params = new Object();
params.value1 = "test";
params.value2 = "param";
params.clubID = curClub ;
options.params = params;
options.chunkedMode = false;
var ft = new FileTransfer();
ft.upload(imageURI, "url", win, fail, options);
}
function win(r) {
console.log("Code = " + r.responseCode);
console.log("Response = " + r.response);
console.log("Sent = " + r.bytesSent);;
}
function fail(error) {
alert("An error has occurred: Code = " = error.code);
}
HTML:
<div data-role = "button" onClick = "getImage();" >Upload Logo</div>
If i test the getImage() function by adding an alert inside, it works, so i know that it is going there. What else am I doing wrong?