PHP 中通过 API 上传 Dropbox 文件的问题
我刚刚在使用 Dropbox API 时偶然发现了一个问题。 目前我正在使用这个库: http://code.google.com/p/dropbox- php/
问题是,如果我上传一个文件,我会成功,但 Dropbox 却什么也没有收到。 我还“黑入”了图书馆并更改了一些帖子内容。如果你愿意的话我可以发布它。
有人有解决办法吗? 谢谢!
//编辑:我正在使用 PHP 集成的 OAuth 功能 //EDIT2:
<?php
include "class/Dropbox/autoload.php";
$oauth = new Dropbox_OAuth_PHP("xxxxxxxxxxx", "xxxxxxxxxxx");
$dropbox = new Dropbox_API($oauth);
//re-login
if(isset($_SESSION["oauth_tokens"])) {
$my->oauth->setToken($_SESSION["oauth_tokens"]);
}
//uploads itself to DB
if($dropbox->putFile( basename(__FILE__), __FILE__ )) {
echo "Success";
} else {
echo "Fail :(";
}
当然这不是完整的代码,但假设用户已登录。:)
I just stumbled over a problem using the Dropbox API.
Currently I am using the this lib: http://code.google.com/p/dropbox-php/
The problem is, if I upload a file I get a success but nothing arrives at the Dropbox.
I also "hacked" into the library and changed some of the post stuff. I can post it if you want.
Anybody got a solution for that?
Thanks!
//EDIT: I am using PHPs integrated OAuth functions
//EDIT2:
<?php
include "class/Dropbox/autoload.php";
$oauth = new Dropbox_OAuth_PHP("xxxxxxxxxxx", "xxxxxxxxxxx");
$dropbox = new Dropbox_API($oauth);
//re-login
if(isset($_SESSION["oauth_tokens"])) {
$my->oauth->setToken($_SESSION["oauth_tokens"]);
}
//uploads itself to DB
if($dropbox->putFile( basename(__FILE__), __FILE__ )) {
echo "Success";
} else {
echo "Fail :(";
}
sure this is not the complete code but assume that the user is logged in. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Dropbox for PHP(您用来将文件上传到 Dropbox 的库)已不再维护,因此可能无法正常运行。
尝试 PHP Dropbox Uploader。 Dropbox 官方 wiki 中提到了这一点。
Dropbox for PHP, the library you're using to upload files to Dropbox, isn't maintained anymore and therefore may not function properly.
Try out PHP Dropbox Uploader. It is mentioned on the official Dropbox wiki.