I am trying to upload file using dropbox api but following Code shows some errors as:
bootstrap.php
// Register a simple autoload function
spl_autoload_register(function($class){
$class = str_replace('\\', '/', $class);
require_once('../' . $class . '.php');
});
// Set your consumer key, secret and callback URL
$key = 'XXXXXXXXXXXXX';
$secret = 'XXXXXXXXXXXXX';
// Check whether to use HTTPS and set the callback URL
$protocol = (!empty($_SERVER['HTTPS'])) ? 'https' : 'http';
$callback = $protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
// Instantiate the required Dropbox objects
$encrypter = new \Dropbox\OAuth\Storage\Encrypter('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
$storage = new \Dropbox\OAuth\Storage\Session($encrypter);
$OAuth = new \Dropbox\OAuth\Consumer\Curl($key, $secret, $storage, $callback);
$dropbox = new \Dropbox\API($OAuth);
putFile.php
// Require the bootstrap
require_once('bootstrap.php');
// Create a temporary file and write some data to it
$tmp = tempnam('/tmp', 'dropbox');
$data = 'This file was uploaded using the Dropbox API!';
file_put_contents($tmp, $data);
// Upload the file with an alternative filename
$put = $dropbox->putFile($tmp, 'api_upload_test.txt');
// Unlink the temporary file
unlink($tmp);
// Dump the output
var_dump($put);
Code By: BenTheDesigner-Dropbox
Error: Fatal error: Uncaught exception 'Dropbox\Exception' with message 'App folder (sandbox) access attempt failed because this app is not configured to have an app folder. Should your access type be 'dropbox' instead? (Status Code: 403)' in C:\wamp\www\BenTheDesigner-Dropbox-b49576c\Dropbox\OAuth\Consumer\Curl.php on line 103
( ! ) Dropbox\Exception: App folder (sandbox) access attempt failed because this app is not configured to have an app folder. Should your access type be 'dropbox' instead? (Status Code: 403) in C:\wamp\www\BenTheDesigner-Dropbox-b49576c\Dropbox\OAuth\Consumer\Curl.php on line 103
i have no idea what to do?