Ionic 2 is completely different syntax, so I mentioned it in case someone could spot a syntax issue.
I receive the console.log("error"); - when I try to display the error parameter which is mentioned in the docs I receive [Object object]. Debugging is via the command line option and I’m using an iOS emulator.
My thoughts are it’s a path issue - ${file} is pdf/example.pdf, so maybe it’s the applicationDirectory path?
That source has a double / in V2%20Test.app//www/pdf/example.pdf, maybe it is that.
For me second path is correct, idk a lot about downloading files but i think the error is in the path of source.
the /// part is fine, try opening a file in your local machine to your browser and you will see the same, that’s the file protocol that the browsers use to define that the file they are requesting is in the hard drive of the same PC, same goes for devices.
Can you see anything in the error output that gives a clue regarding the problem? Can’t find any mention of what error the number 3 represents, and if there’s a path error (bear in mind this is on an iOS simulator)
Try logging the pdfLocation and targetPath just above the download call, also you could create an extra folder to avoid polluting the www folder, though the last part shouldn’t be an issue.
Hello !
I’m new to ionic2 and I’ve got a problem loading the plugin, maybe you can help me ?
When I do this :
upload() {
this.platform.ready().then(() => {
// Upload the file
this.ft = new FileTransfer();
I’ve got an error like this :
Unhandled Promise rejection: FileTransfer is not defined ; Zone: angular ; Task: Promise.then ; Value:
ReferenceError: FileTransfer is not defined
Of I’ve added the plugin with “ionic plugin add cordova-plugin-file-transfer” but I think I missed something else…
I’m running ionic 2.0.0-beta.4, thanks for your help.
Oh - I think Ionic have removed Webpack from Ionic 2 in favour of Browersify. I updated to beta.4 and did the standard ‘ionic new … --ts’ initialisation to create the project.
I have made a huge update to the project recently, make sure you’ve got the latest version!
I am now using Ionic Native with it, so to install it’s (so ionic plugin add cordova-plugin-file-transfer to install and const fileTransfer = new Transfer(); to use rather than new FileTransfer which I think you have?)