[英]How can I store the files in my server after picking the files from dropbox with the dropbox Chooser using java
[英]Dropbox Chooser to upload files from user's dropbox account
嗨,我實現了用戶可以從其保管箱帳戶上傳圖片的功能。 為此,我找到了Dropbox Chooser,它有助於從我們的Dropbox帳戶上傳文件。 以下是代碼,用於保管箱選擇器文檔。 當我單擊按鈕時,它應該使用保管箱登錄屏幕打開該窗口。 我得到了保管箱屏幕,但顯示消息“對不起,這個小問題……。請嘗試重新修飾頁面”。 我發現了一些類似的問題論壇,並遵循了他們的解決方案。 當然,沒有一個有效。 任何幫助,將不勝感激。 TIA
Index.php
<div id="dropbox-upload-container"></div>
<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="wgiv8kvzvq57mlw"></script>
<script type="text/javascript">
options = {
success: function(files) {
files.forEach(function(file) {
// add_img_to_list(file);
});
},
cancel: function() {
//optional
},
linkType: "preview", // "preview" or "direct"
multiselect: true, // true or false
extensions: ['.png', '.jpg'],
};
var button = Dropbox.createChooseButton(options);
document.getElementById("dropbox-upload-container").appendChild(button);
</script>
通過在服務器中設置html頁面可以避免此錯誤。 為此,我使用了express-node.js。
以下是代碼段: finaltest.js
var express = require('express');
var app = express();
app.use(express.static('public'));
app.get('/', function (req, res) {
res.sendFile( __dirname + "/" + "finaltest.html" );
})
var server = app.listen(8081)
對於html,js: https : //codepen.io/sreepurna/pen/NYmMaj
現在運行服務器- 節點finaltest.js
轉到網絡瀏覽器並使用http:// localhost:8081 。
希望這可以幫助!!!!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.