apache / cordova-plugin-file-transfer

Apache Cordova File Transfer Plugin
https://cordova.apache.org/
Apache License 2.0
595 stars 888 forks source link

Can I not provide a file name when downloading? #262

Closed kt-at-cbx closed 3 years ago

kt-at-cbx commented 3 years ago

I am using FileTransfer plugin to download a file. But I want to keep the original filename of the file but not a one I assigned. Can I keep the original file name when downloading it?

ie. I don’t want to change 'file.pdf' manually in below code:

fileTransfer.download(url, this.file.dataDirectory + 'file.pdf')

Thanks

PS. My url will not contain any file name (will be something like: https://example.com/<id>?sp=r&st=2020-07-22&sig=<other-id>&srt=o&ss=b ) so it is quite not possible to get the filename from the url. But if open the link in browser, I can download it with a meaningful filename.

elvisgraho commented 3 years ago

Download first and then change the filename based on metadata?

breautek commented 3 years ago

It's up to your application to decide the filename. The file transfer plugin doesn't really have an opinion on this.

Common practices are: