Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49083

Download/Save a URL Image file to Photo Gallery for iOS

$
0
0

@sritharan wrote:

I have been trying to download a URL Image file to the photo gallery on iOS. but it ends with an permission error. have a look at my code that am using to store image.

$scope.Download = function (imgurl) {
$ionicPlatform.ready(function(){
var url = imgurl;
var filename = url.split("/").pop();
var targetPath = cordova.file.documentsDirectory + filename;
console.log(cordova.file.documentsDirectory);
$cordovaFileTransfer.download(url, targetPath, {}, true).then(function (result) {
$scope.hasil = 'Save file on '+targetPath+' success!';
$ionicLoading.hide();
$scope.mywallpaper=targetPath;
}, function (error) {
$scope.hasil = 'Error Download file';
}, function (progress) {
$scope.downloadProgress = (progress.loaded / progress.total) * 100;
});
});
};
if am wrong on any point. please let me know.
Thanks for the help.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>