我正在尝试使用 dropbox api 上传文件,但以下代码显示一些错误:
引导程序.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);
代码作者:BenTheDesigner-Dropbox
错误: 致命错误:未捕获异常 'Dropbox\Exception' 并带有消息“应用程序文件夹(沙盒)访问尝试失败,因为此应用程序未配置为具有应用程序文件夹。您的访问类型应该改为“保管箱”吗?(状态代码:403)'在 C:\wamp\www\BenTheDesigner-Dropbox-b49576c\Dropbox\OAuth\Consumer\Curl.php 第 103 行
( ! ) Dropbox\Exception: 应用程序文件夹(沙盒)访问尝试失败,因为此应用程序未配置为具有应用程序文件夹。您的访问类型应该改为“保管箱”吗?(状态代码:403)在 C:\wamp\www\BenTheDesigner-Dropbox-b49576c\Dropbox\OAuth\Consumer\Curl.php 第 103 行
我不知道该怎么做?