In an angular/ionic app, I have the following code to download a pdf from the internet.
public pdfDownload(){
const fileTransfer: FileTransferObject = this.transfer.create();
const mime = 'application/pdf';
const pdfFile = 'http://www.pdf995.com/samples/pdf.pdf';
// alert(this.file.dataDirectory);
fileTransfer.download(pdfFile, this.file.dataDirectory + 'file.pdf', true)
.then((entry) => {
alert('download complete: ' + entry.toURL());
}, (error) => {
// handle error
});
}
But now Im looking for this file in my android phone but I cant find it. The path in my phone is
There are no files. Where did I download it?
Use this.file.externalDataDirectory+'file.pdf' instead of this.file.dataDirectory+'file.pdf' in second parameter of function fileTransfer.download(1 parameter,2 parameter,3 parameter);
e.g.
fileTransfer.download(pdfFile, this.file.externalDataDirectory + 'file.pdf', true)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With