cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

dropbox chooser question

dropbox chooser question

Nicolas A.2
New member | Level 1

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 4

Greg-DB
Dropbox Staff

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
New member | Level 1

# 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
Dropbox Staff

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. 

Nicolas A.2
New member | Level 1

Ok thanks, i'll try to find another solution šŸ˜‰

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Nicolas A.2 New member | Level 1
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?