Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

PSMDanny's avatar
PSMDanny
Explorer | Level 3
7 years ago

How to retrieve a list of links of a user folder

Hi, hoping to get some help here regarding my issue. In my (php) application I want my users to upload images inside their folder (myapp - their app folder). I can upload files, I can show a list of files...that's working great. But...

I want to retrieve (for the user) a list of links inside a folder (so his own files).  For now I tried to get a list of files, loop through the list and get the link of each file seperately like this:

$getFiles = $dropbox->GetFiles("/try", false);
echo '<pre>'; echo print_r($getFiles); echo '</pre>'; 

if (!empty($getFiles)) {
    echo "total files in this project = " . count($getFiles) . "</br>";
    foreach ($getFiles as $file) { ?>
        <a href="<?php echo $dropbox->GetLink($file, true); ?>"><?php echo $file->name; ?></a><br />
    <?php 
    }   
}

In a folder with 5 files it takes 5-10 seconds before every link is created....which of course is a bad user experience. Is there another way to do this or is this the only way (can't imagine it is).

Thanks in advance,
Danny

2 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    7 years ago
    The Dropbox API doesn't offer a faster way to create shared links, e.g., a batch call for this, but I'll pass this along as a feature request.
  • PSMDanny's avatar
    PSMDanny
    Explorer | Level 3
    7 years ago

    Hi Greg,

    Thanks for your superfast support. Really appreciate it! Too bad this isn't offered (yet). I'm going to play with a solution to store every url in the database. Thinks that's what everyone does to keep the speed in the user experience and to limit the number of api request.

    Thanks.
    Danny

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

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!