2

This is my first attempt using Dropbox API and I'm just following the "Hello World" from PHP SDK. Upload methods is working fine, but download:

$app = new DropboxApp("...", "...", "...");
$dropbox = new Dropbox($app);
$file = $dropbox->download("/image.png", '/image.png');

Return this warning:

Warning: curl_exec(): Could not call the CURLOPT_WRITEFUNCTION in /srv/www/website/public_html/dropbox/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php on line 40

Fatal error: Uncaught RuntimeException: Unable to open /image.png using mode w+: fopen(/image.png): failed to open stream: Permission denied in /srv/www/website/public_html/dropbox/vendor/guzzlehttp/psr7/src/functions.php:299 Stack trace: #0 [internal function]: GuzzleHttp\Psr7{closure}(2, 'fopen(/unifeal-...', '/srv/www/website/...', 307, Array) #1 /srv/www/website/public_html/dropbox/vendor/guzzlehttp/psr7/src/functions.php(307): fopen('/image.p...', 'w+') #2 /srv/www/website/public_html/dropbox/vendor/guzzlehttp/psr7/src/LazyOpenStream.php(37): GuzzleHttp\Psr7\try_fopen('/image.p...', 'w+') #3 /srv/www/website/public_html/dropbox/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php(31): GuzzleHttp\Psr7\LazyOpenStream->createStream() #4 /srv/www/website/public_html/dropbox/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php(136): GuzzleHttp\Psr7\LazyOpenStream->__get('stream') #5 /srv/www/website/public_html/dropbox/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(380): GuzzleHttp\Psr7\LazyOpenStream-> in /srv/www/website/public_html/dropbox/vendor/guzzlehttp/psr7/src/functions.php on line 299

I'm testing using Vagrant.

UPDATE

I can confirm that is not a permission issue because download works using this script:

$file = $dropbox->download("/image.png");
$contents = $file->getContents();
file_put_contents(__DIR__ . "/image.png", $contents);
$metadata = $file->getMetadata();

But not using the recommended way.

marcelo2605
  • 2,734
  • 4
  • 29
  • 55

0 Answers0