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

Where the download file saved in iOS phone

$
0
0

@gurjit_onebcg wrote:

Ionic version:
Ionic Framework Version: 3.0.1

I have created a sample app to download a file in Mobile device
but when I click on download button, I see the download succeeded meessage. But image
does not appear in my PHOTOS .

Current behavior:
Image is not appearing in PHOTOS .

Expected behavior:
Downloaded image should appear in PHOTOS .

Related code:
Type Script Code
"
import {Component} from ‘@angular/core’;
import {NavController, Platform, AlertController} from ‘ionic-angular’;
import {Transfer, TransferObject} from ‘@ionic-native/transfer’;
import {File} from ‘@ionic-native/file’;

@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’,
providers: [Transfer, TransferObject, File]
})

export class HomePage {

storageDirectory: string = ‘’;

constructor(public navCtrl: NavController, public platform: Platform, private transfer: Transfer, private file: File, public alertCtrl: AlertController) {
this.platform.ready().then(() => {
// make sure this is on a device, not an emulation (e.g. chrome tools device mode)
if(!this.platform.is(‘cordova’)) {
return false;
}

this.storageDirectory = cordova.file.documentsDirectory;

});
}

downloadImage(image) {

this.platform.ready().then(() => {

const fileTransfer: TransferObject = this.transfer.create();

const imageLocation = sourcePath;

fileTransfer.download(imageLocation, this.storageDirectory + image).then((entry) => {

const alertSuccess = this.alertCtrl.create({
title: Download Succeeded!,
subTitle: ${image} was successfully downloaded to: ${entry.toURL()},
buttons: [‘Ok’]
});

alertSuccess.present();

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49224

Trending Articles



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