cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done 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

Re: dropbox chooser question

Greg-DB
Dropboxer

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?

Re: dropbox chooser question

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

Re: dropbox chooser question

Greg-DB
Dropboxer

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. 

Re: dropbox chooser question

Nicolas A.2
New member | Level 1

Ok thanks, i'll try to find another solution 😉

Who's talking

Top contributors to this post

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