You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
James_T
4 years agoHelpful | Level 6
Listing files in a folder, and make download links for all files?
I have a private Dropbox.
I have a PHP-driven webpage where i want to list clickable links to some files in a specific folder in my dropbox. It's simple to list the files on my web page, I just ...
macribas
4 years agoDropbox Staff
You need to loop that array and create links for each file.
Take a look at the /sharing/create_link_with_settings endpoint.
Alternatively, we provide an embedded component to display the contents of a folder directly in a web page:
https://dropbox.tech/developers/now-available--dropbox-embedder
Maybe that will make your life easier.
- James_T4 years agoHelpful | Level 6
Won't looping through every file and folder and make a ton of share links be very slow?
The embedding solution seems more sensible, but if I understand correctly:
1. The root folder must have a share link created first
2. I have no control over which files and folders are displayed (I can't choose to hide a specific subfolder, or a specific file)
- Greg-DB4 years agoDropbox Staff
James_T Yes, /2/sharing/create_shared_link_with_settings requires one call per item, so if there's a significant number to process, that would take a significant amount of time. That being the case, you could also consider only creating the shared link on demand, when the user clicks on a specific file. That is, the listed on your file on your page would link to a route on your server, which when accessed, would make the Dropbox API call and then redirect the user to the returned link. (Likewise, /2/files/get_temporary_link would also work here, if you just need a temporary direct download link instead of a shared link.)
Alternatively, if you want to have the user's browser download the file directly, you could use /2/files/download on your server when the user clicks on a particular file. That would require passing the file data through your server each time though.
And yes, your understanding of the Embedder is correct. It would take a single shared link for the parent folder, and would then list everything in that linked parent folder.
- James_T4 years agoHelpful | Level 6
Thanks for the replies!
I think I will go for the Embedder route, even though it has some drawbacks in my case. It really is a shame that the Embedder isn't more customizable.
In our company, we create a root folder for all new projects, with a bunch of subfolders we work on from a PC. On our internal website we want our employees to be able to access the content of only certain of those folders.
The problems with the embedder is:
1. The folder needs a share link. Workaround: When creating the project folders, make a share link and save to DB.2. Sharing the folder gives access to all folders. Workaround: Create a subfolder called "web" and move the folders employees needs access to there, and share that one instead.
The second workaround is the biggest problem for us, since that means an extra click into the "web" folder every time we work on our folders from a PC - which we do a lot (for those who don't know, it's also not very logic why some folders are not in the root, while others are)
All in all, I think the Embedder route is a better option than spending a bunch of time recreating what is basically a custom version of the embedder, which will never be as nice (previews, icons etc).
- Здравко4 years agoLegendary | Level 20
James_T wrote:Won't looping through every file and folder and make a ton of share links be very slow?
...
Здравко wrote:
... Existing links could be enumerated with sharing/list_shared_links. ...If you take care every file you want to show to be associated in advance with a shared link, listing process is just a single API call. 😉 Even more, you can filter the results "on fly" and filter any unwanted entry with a shared link. Is this so slow? 🤔 Probably it depends on your data structure...
Good luck.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days agoIf 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 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!