Reputation: 86
I m using https://github.com/kunalvarma05/dropbox-php-sdk this library in my laravel project .From this code this "example.txt" file downloaded in my project directory. But i want to download this "example.txt" file with my browser into browser download folder.
$file = $dropbox->download("/example.txt");
$contents = $file->getContents();
$metadata = $file->getMetadata();
file_put_contents(__DIR__ . "/example.txt", $contents);
Upvotes: 1
Views: 2013
Reputation: 138
A little use with Google and found it for you.
$file = $dropbox->download("/my-logo.png");
//File Contents
$contents = $file->getContents();
//Save file contents to disk
file_put_contents(__DIR__ . "/logo.png", $contents);
//Downloaded File Metadata
$metadata = $file->getMetadata();
//Name
$metadata->getName();
link to examples and github: https://github.com/kunalvarma05/dropbox-php-sdk/wiki/Upload-and-Download-Files
Upvotes: 1