Discuss Dropbox Developer & API
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_Dimitrov.jpg?dl=1
and get file dow0nloaded: morning.jpg instead of 270px-July_Morning_Boby_Dimitrov.jpg
Content-Disposition header didn't work for me .
Any ideas how to do that ?
I recently developed a activestorage-dropbox gem for rails that wraps the Dropbox Storage Service as an Active Storage service. I am hoping the Content-Disposition functionality in dropbox as it's very much important for maintaining the robustness and quality of the functionality.
https://github.com/ashishprajapati/activestorage-dropbox
Thanks
Ashish Prajapati
Rails Contributor
The 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.
I see, thanks for clarifying. Dropbox unfortunately doesn't offer an option for setting the download name like that.
I'll pass this along as a feature request. I can't promise if or when that might be implemented though, so I recommend trying to accomplish this locally instead.
Do you know when this feature will be available?
@spotloader This feature request was filed with the team, but I don't see any plans to implement it currently.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
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!