I am using fileupload phonegap plugin to upload jpeg file to my server from iPad. It is not working for me.
Here is my code:
window.plugins.fileUploader.uploadByUri('http://192.168.1.54:8080/POC/fileUploader', 'file://Documents/flower.jpg', null, 'myPhoto', 'flower.jpg', 'image/jpeg',
function(result) {
console.log('Done: ' + result);
},
function(result) {
console.log("Error: " + result);
}
);
In fileUploader.js file, I put an alert below the uploadbyuri method. But its not displaying. That means that method is not calling.
What mistake I have done? Please help me.
Please check this plugins its works for me.
https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/FileUploader
and if its not working please specify proper error that you are getting for upload image.
Me too had the same situation. FileUploader worked fine in cordova1.9.0. When i changed to cordova2.7.0 face the same situation. After a long time messing with the issue, I made it work by remnaming "Phonegap" to "cordova" in fileuploader.js file which is in www folder.
PhoneGap.addConstructor(function() {....
to
cordova.addConstructor(function() {....
and
return PhoneGap.exec('FileUploader.' + method, callback + '.success', callback + '.fail', callback + '.progress', server, file, fileKey, fileName, mimeType, params);
to
return cordova.exec(null,null,"FileUploader", "uploadByUri",[ callback + '.success', callback + '.fail', callback + '.progress', server, file, fileKey, fileName, mimeType, params]);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.