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's avatar
James_T
Helpful | Level 6
4 years ago

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 use "files/list_folder/" to get an array of the files in the wanted folder.

 

But how can I get URLs to download the files, so I can make my list of files clickable?

    • James_T's avatar
      James_T
      Helpful | 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-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox 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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,910 PostsLatest Activity: 3 days ago
333 Following

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 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!