I have installed the file and file-transfer plugins. I am downloading an image to the local file system but having issues. The $cordovaFile.downloadFile is returning a result. I can log the result.toURL() and see the file path.I then try to confirm this with a call to $cordovaFile.checkFile passing the result.toURL(). I get a error returned of undefined. The reason I am checking its existence is I am having difficulty attaching a image using the email-composer plugin. It gives me an Attachment path not found: error.Am I missing something?
var source = vm.catalogs[currentPage].largeimageuri;
var filename = source.substring(source.lastIndexOf('/')+1);
var dir = cordova.file.documentsDirectory;
var filePath = dir + filename;
$cordovaFile.downloadFile(source, filePath, true).then(function(result) {
console.log("download complete: " + result.toURL());
$cordovaFile.checkFile(result.toURL()).then(function(result) {
// Success!
console.log('File Success!');
}, function(err) {
// An error occured. Show a message to the user
console.log(err);
});
}, function(err) {
console.log(err);
});