We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
codingnightmare
7 years agoExplorer | Level 4
Content-Disposition in dropbox
Is there a way to rename a file while downloading from dropbox without changing the filename itself : For example: Dropbox link : https://www.dropbox.com/s/b06pn1n7w75ihyz/270px-July_Morning_Boby_D...
Greg-DB
Dropbox Community Moderator
7 years agoThe filename in Dropbox, and thereby in the shared link, is set when the file is uploaded. The vaue in the 'content-disposition' response header will also be based on that filename in Dropbox.
It sounds like you want to change the filename for your resulting local copy of the file when downloading from a shared link, not the filename in Dropbox itself.
Since that affects the file being written locally, exactly how you do that would depend on the HTTPS client you're using to download and write the file locally.
For example, using 'curl' like this would result in a file named "270px-July_Morning_Boby_Dimitrov.jpg?dl=1":
curl -L -O "https://www.dropbox.com/s/b06pn1n7w75ihyz/270px-July_Morning_Boby_Dimitrov.jpg?dl=1"
That option takes the filename from the URL.
Whereas using 'curl' like this would result in a file named "270px-July_Morning_Boby_Dimitrov.jpg":
curl -L -OJ "https://www.dropbox.com/s/b06pn1n7w75ihyz/270px-July_Morning_Boby_Dimitrov.jpg?dl=1"
That option takes the filename from the header.
And using 'curl' like this would result in a file named "morning.jpg":
curl -L -o "morning.jpg" "https://www.dropbox.com/s/b06pn1n7w75ihyz/270px-July_Morning_Boby_Dimitrov.jpg?dl=1"
That option takes the filename as specified on the command line.
I recommend referring to the documentation for whatever client you're using for information on how to set the local filename.
- codingnightmare7 years agoExplorer | Level 4I want the user to download the file from dropbox by adding a parameter or http header to the link and get the file with the new name, not through another server or rename it locally. I want dropbox to download the file with new name that I will pass in content-disposition headers or other params. I really need this functionality :(
Well, with in active storage, we never stores the files with their real name. We just name it with some unique number or id and we stores the real name in our database. So what we really want, we want a way to pass a the real name in some header or parameters and it will use this name for the file directly at dropbox for downloading it. And will not affect the file.- codingnightmare7 years agoExplorer | Level 4Greg, If you will check these links then you will realise that what I am exactly looking for:
Similar think is possible at GCS:
https://stackoverflow.com/questions/21026132/google-cloud-storage-download-a-file-with-a-different-name
Similar thing is possible with S3:
https://stackoverflow.com/questions/2611432/amazon-s3-change-file-download-name/2612795#2612795
Thanks- Greg-DB7 years ago
Dropbox Community Moderator
I see, thanks for clarifying. Dropbox unfortunately doesn't offer an option for setting the download name like that.
About Discuss Dropbox Developer & API
Make connections with other developers
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!