使用/ files_put的JavaScript文件上传到Dropbox的 [英] upload file to dropBox using /files_put javascript

查看:149
本文介绍了使用/ files_put的JavaScript文件上传到Dropbox的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以上传本地文件使用HTTP PUT方法收存箱?
我正在上传文件,但它是没有身体? (字节: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 ?

我的code是以下内容:

my code is the following :

    $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/核心/文档#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的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆