0

I want to retrieve all the images stored in my dropbox account .I try Many Solutions But i can't retrive images . Images are located in folders on Dropbox account . Can Any One Please Help me Out ??

$session = new DropboxSession(
    $config["dropbox"]["app_key"], 
    $config["dropbox"]["app_secret"], 
    $config["dropbox"]["access_type"], 
    $access_token
);
$client = new DropboxClient($session);

$path = (!empty($_GET["path"])) ? $_GET["path"] : "/";
// List contents of home directory
if ($home = $client->get_files($path)) {
    echo "<p>Metadata content for <code>" . $path . "</code></p>";
    echo "<pre>" . print_r($home, true) . "</pre>";
}
    }
    catch (Exception $e) {
    echo "<strong>ERROR (" . $e->getCode() . ")</strong>: " . $e->getMessage();
    if ($e->getCode() == 401) 
    {
     // Remove auth file
     unlink($config["app"]["authfile"]);
     // Re auth
     echo '<p><a href="authorize.php">Click Here to re-authenticate</a></p>';
    }
 }

And Here is The DROPBOX Client Function .

   public function get_files($path, $hash = null, $revision = null) {
    // Prepare argument list
    $args = array(
        "hash" => $hash,
        "rev" => $revision
    );
    // Prepend the right access string to the desired path
    if ("dropbox" == $this->accessType) {
        $path = "auto" . $path;
    }
    else {
        $path = "sandbox" . $path;
    }

    // Execute
        $response = $this->Session->fetch("GET", $this->dropboxAPIURL,    "/shares/" . $path, $args);
    return $response["body"];
}

Error : dropbox/Photos Not Found Any Idea ???

Coder Me
  • 63
  • 9
  • You're already including auto/ as the root in the path, so you don't need to include 'dropbox/' or 'sandbox/' too. – Greg Jun 30 '16 at 17:59
  • its still not working – Coder Me Jun 30 '16 at 18:19
  • Please update your post with the a sample request and response showing the full error then. – Greg Jun 30 '16 at 18:20
  • Array ( [error] => Array ( [path] => The root path ("/") is not allowed. ) ) – Coder Me Jun 30 '16 at 18:32
  • i need all the images which are present in my dropbox . Is this correct way to fetch data ?? – Coder Me Jun 30 '16 at 18:34
  • The error message indicates that you're attempting to get a shared link for your root Dropbox folder, which isn't allowed. Make sure your `$path` variable contains the path to the desired non-root file or folder you want a link for. – Greg Jun 30 '16 at 18:36
  • @Greg Do You Know any other way ?? – Coder Me Jul 01 '16 at 09:06

0 Answers0