本文介绍了使用/files_put javascript 上传文件到 dropBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用 http put 方法将本地文件上传到 dropbox?我正在上传一个文件,但它没有正文?(字节":0)
Is it possible to upload a local file to dropbox using http put method ?i am uploading a file but it is without body ? ( "bytes": 0 )
如何将内容添加到我的文件中?
how can i add a content to my file ?
我的代码如下:
$scope.uploadHtmlFile = function() {
$http({
method: 'PUT',
url: 'https://api-content.dropbox.com/1/files_put/dropbox/test.txt?access_token='+ localStorage.getItem('accessToken')
}).success(function(data,status,headers,config){
console.log(data);
console.log('file uploaded successfully');
}).error(function(data,status,headers,config){
});
}
我的文件已成功上传但没有内容?它是空的!!文档对我来说有点混乱:https://www.dropbox.com/developers/核心/docs#files_put
my file is successfully uploaded but with no content ? it is empty !!the documentation is a little confusing to me : https://www.dropbox.com/developers/core/docs#files_put
推荐答案
@smarx : 我发出了一个空的 HTTP PUT 请求,最后我以这种方式解决了我的问题:
@smarx : i was making an empty HTTP PUT request, and i ended up by solving my issue this way:
$scope.uploadHtmlFile = function() {
var data = "This is a file upload test ";
$http({
method: 'PUT',
url: 'https://api-content.dropbox.com/1/files_put/dropbox/test.html?access_token=' + localStorage.getItem('accessToken'),
data: data
}).success(function(data, status, headers, config) {
console.log(data);
console.log('file uploaded successfully');
}).error(function(data, status, headers, config) {
});
}
感谢您的反馈!
这篇关于使用/files_put javascript 上传文件到 dropBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!