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

Forum Discussion

Nicolas A.2's avatar
Nicolas A.2
New member | Level 1
9 years ago

dropbox chooser question

Hello

Is it possible to use the chooser without the selection window ? I would go myself files parameters

ex : list my dropbox's files -> chooser -> get link 

i've already try with the PHP api's fonction "createTemporaryDirectLink" but it creates a share link and script execution time is very long

thanks

sorry for my english 

 

4 Replies

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    No, it's not possible to use the Chooser without user interaction.

    The createTemporaryDirectLink method in the PHP is a good alternative then. It returns a link just like the "direct link" type from the Chooser, but can be used completely programmatically. You can then download the file content via the returned link.

    Can you share the code that's not working as desired?

  • Nicolas A.2's avatar
    Nicolas A.2
    New member | Level 1
    9 years ago

    # Include the Dropbox SDK libraries
    require_once "./../../../lib/dropbox-sdk/Dropbox/autoload.php";

    use \Dropbox as dbx;

    $appInfo = dbx\AppInfo::loadFromJsonFile("./../../../lib/dropbox-sdk/app-info.json");
    $webAuth = new dbx\WebAuthNoRedirect($appInfo, "PHP-Example/1.0");

    $authorizeUrl = $webAuth->start();

    $dbxClient = new dbx\Client("XXXXXXXXXXXXXXXXXXXXXXXX", "PHP-Example/1.0");
    $accountInfo = $dbxClient->getAccountInfo();

    //path exemple for the test

    $folderMetadata = $dbxClient->getMetadataWithChildren("/images");

    for ($i = 0; $i < count($folderMetadata["contents"]); $i++) {
    $path = $folderMetadata["contents"][$i]["path"];
    $link = $dbxClient->createTemporaryDirectLink($path);
    echo '<a href="' . $link[0] . '"><img src="' . $link[0] . '" /></a><br />';
    }

     

    This code works fine but if I list 20 images , the page takes 20 seconds to be displayed.

    Do you have a solution ?

    thank you for your reply

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    Each call to createTemporaryDirectLink will make another network request, to get the requested information from the Dropbox API, so unfortunately there will be a good amount of overhead for that. I'm afraid I don't have a good solution, but I'll be sure to pass this along as feedback. 

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!