I am using the file transfer plugin (org.apache.cordova.file-transfer) v.4.3 to download images from my back-end api.
I am following the conventions specified in the latest realease.
As you can see my destination file is built using cdvfile.
I am using this code:
function fileDownload(serverURL, token, imageName) {
var deferred = $q.defer();
var ft = new FileTransfer()
var fileURL = "cdvfile://localhost/persistent/MyFolder/" + imageName;
ft.download(encodeURI(serverURL), fileURL,
function (result) {
deferred.resolve(result);
},
function (reason) {
deferred.reject(reason);
},
false,
{
headers: { 'Authorization': 'Bearer ' + token }
});
return (deferred.promise);
};
and everything works fine and my files now are save in a custom app folder (MyFolder).
I would like to save the image in my image gallery.