cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right 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: 

I can't download my files with PHP Core API

I can't download my files with PHP Core API

Burak_Cayir
Explorer | Level 3

I have a Dropbox basic account, and these are my download codes. But I cant download my files with core API. Please help me .

require_once "lib/Dropbox/autoload.php";
use \Dropbox as dbx;
$appInfo = dbx\AppInfo::loadFromJsonFile("app-info.json");
$webAuth = new dbx\WebAuthNoRedirect($appInfo, "PHP-Example/1.0");

$authorizeUrl = $webAuth->start();

$accessToken = '<ACCESS_TOKEN>';

$dbxClient = new dbx\Client($accessToken, "PHP-Example/1.0");

$f = fopen("2016-2017-bahar-donemi-bilgisayar-muhendisligi-ders-programi.xls", "w+b");
$fileMetadata = $dbxClient->getFile("/2016-2017-bahar-donemi-bilgisayar-muhendisligi-ders-programi.xls", $f);
fclose($f);
11 Replies 11

Burak_Cayir
Explorer | Level 3
and I can see tüfek.jpg details with an array.

Greg-DB
Dropbox Staff

[Cross-linking for reference: https://stackoverflow.com/questions/42690512/download-file-not-working-with-dropbox-api ]

 

Thanks for following up with the additional information. If you're seeing the file metadata as you describe, that means the API call itself worked.

 

When using that getFile method like this,  the file data is saved to the file object supplied by to the resource $outStream parameter. In your case, that's your $f file object. Once that method completes successfully, you can then read the data from that file, which in your case is at the path "tufek.jpg".

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Burak_Cayir Explorer | Level 3
What do Dropbox user levels mean?