When move file in ngCordova or Cordova, it will need 2 plugins.
- cordova plugin add org.apache.cordova.file
- cordova plugin add org.apache.cordova.file-transfer
basic usage.
1 | $cordovaFile.downloadFile(source, filepath, true, {}).then(function(result) { |
it’s same as
1 | var fileTransfer = new FileTransfer(); |
if you want to use it with $cordovaCamera.getPicture(), you will need to resolve FILE_URI first, and use it as source.
1 | function getImageFileName(image) { |
another problem is filepath. basePath can find it by below code. and filepath need a filename at the end.
1 | $cordovaFile.createDir(directory, false).then(function(entry) { |