I am new to using php and dropbox, so this query may seem simple.
My application is to integrate the ability to upload/download to a specified folder in my Dropbox.
I can do the following in php (with the help of CodeCourse)
- authenticate
- list my files in a given folder
- upload a file to a given folder
I am struggling with how to download a file to my PC and save it.
Code snippet:
require_once "./dropbox-sdk/Dropbox/autoload.php";
$children = $client->getMetadataWithChildren($path);
$docs = $children["contents"];
# from the $docs array I can get the path to the required file
# I then try
$outStream ='';
$download = $client->getFile($path,$outStream);
header("Content-type: " . $download["mime"]);
echo $download["data"];
exit;
I think the headers may need to be improved but the first problem is that the getFile function errors as I am not initialising $outStream correctly.
Any help would be appreciated