Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dropbox - API get the download link of a file

Tags:

dropbox-api

I have a web app where user can upload a picture of his logo using dropbox api im able to save the file to a dropbox folder which is great

however i want to get the download link so using my angular client ill be able to set the img src tag and show the image

I've been using this implementation:

String url = client.sharing().createSharedLinkWithSettings("/" + clientId + "/logo." + fileName[1]).getUrl();

however as the name implies im getting a share link which is basically a web page with the image i only need the image is it possible?

like image 563
naoru Avatar asked Sep 05 '25 03:09

naoru


2 Answers

This worked for me and was much easier than the solutions above, per this article:

To get a direct download link, replace the www.dropbox.com with dl.dropboxusercontent.com

EDIT: I've also discovered that you can add the query parameter ?dl=1 (dl meaning download and 1 meaning "enabled") to a shared link and that will make it a direct-download link as well. This is likely more reliable (long-term) than the method above.

like image 186
Preston Badeer Avatar answered Sep 07 '25 21:09

Preston Badeer


Yes, use DbxUserFilesRequests.getTemporaryLink instead. That will give you a temporary link that points directly to the file data.

like image 30
Greg Avatar answered Sep 07 '25 22:09

Greg