我将Dropbox选择器放在一起。这个想法是网站用户可以访问Dropbox按钮,并能够下载他们想要的任何文件。当我登录到有问题的帐户时,此方法工作正常,但我不能要求使用该帐户登录。我不知道需要更改什么,将使用的域添加到Dropbox应用程序设置中,这是我的测试代码:
<!DOCTYPE html>
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="xxxxxxxxxxxx"></script>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
</head>
<body>
<div id="container"></div>
<script>
var options = {
linkType: "direct",
multiselect: true,
success: function(files) {
for(i = 0; i< files.length; i++){
var link = document.createElement('a');
var br = document.createElement('br');
link.href = files[i].link;
link.textContent = files[i].link;
document.getElementById('container').appendChild(br);
document.getElementById('container').appendChild(link);
}
}
};
var button = Dropbox.createChooseButton(options);
Dropbox.choose(options);
document.getElementById('container').appendChild(button);
file = {
// Name of the file.
name: "filename.txt",
// URL to access the file, which varies depending on the linkType specified when the
// Chooser was triggered.
link: "https://...",
// Size of the file in bytes.
bytes: 464,
// URL to a 64x64px icon for the file based on the file's extension.
icon: "https://...",
// A thumbnail URL generated when the user selects images and videos.
// If the user didn't select an image or video, no thumbnail will be included.
thumbnailLink: "https://...?bounding_box=75&mode=fit",
};
</script>
</body>
</html>
试试这个链接
它可能会帮助您。首先,您必须注册您的应用程序,然后Dropbox将为您提供一些密钥:将其保存在应用程序的authorize.php文件中,例如
<?php
$access_token = array (
"oauth_token_secret" => "abcdefghilmnopqr",
"oauth_token" => "stuvwxyzabcdefgh",
"uid" => "1234567"
);
第一次运行应用程序时,index.php文件中的以下条件为真:
<?php
if (!isset($access_token)) {
header("Location: authorize.php");
exit;
}
authorize.php将自动为您管理。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句