I am facing an issue with downloading pictures using phonegap cordova 2.1 and displaying them in the gallery of an Apple iPhone or iPad. I have implemented the following JavaScript function:
$("#btnDL").click(function(){
var file = $("#imgViewer img").attr('src');
var aux =file.split('/');
var fName = aux[aux.length - 1];
var fileTransfer = new FileTransfer();
fileTransfer.download(encodeURI(file),"/var/mobile/Applications/9A25FA0A-49A9-4DED-BD83-5FF043A9075/Document/MyApplicationName",function(entry){
alert("Image saved in "+entry.fullPath);
},function(error){
alert("ERR: "+JSON.stringify(error));
});
});
The function indicates that the file was saved on my iPad. However, when I check the gallery, the picture is not there. I have considered creating a plugin in objective-C, but my knowledge of this language is limited. I have also tried to use the following plugins:
and
https://github.com/aaronksaunders/FileDownLoadApp
Unfortunately, they did not yield the desired results.