Hi, I am trying to create an app that will allow users to download and view the file using that app. Was wondering if there’s anyone here who can help me to save downloaded files to application data directory.
Thank you guys so much/
Hi, I am trying to create an app that will allow users to download and view the file using that app. Was wondering if there’s anyone here who can help me to save downloaded files to application data directory.
Thank you guys so much/
I saved an image to local storage using
import { File } from ‘ionic-native’;
checkout the documentation of that native File plugin
let tempPath: string = fileURI.substr(0, fileURI.lastIndexOf('/') + 1);
let tempName: string = fileURI.substr(fileURI.lastIndexOf('/') + 1);
let userAvatar: string = this.userAvatar;
let avatarLocalPath: string = cordova.file.dataDirectory;
//move new file from temp local directory to perm local directory
File.moveFile(tempPath, tempName, avatarLocalPath, userAvatar)
.then(() => {
console.log('app.account.ts saveAvatar File.moveFile success: ' + avatarLocalPath + userAvatar);
})
.catch((err) => {
console.log('app.account.ts saveAvatar File.moveFile error: ' + avatarLocalPath + userAvatar);
});