cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 

File Upload

priyank New member | Level 2
New member | Level 2

I am trying to upload a file using an old dropbox api, When I use the below method the file gets saved and I am able to get the saved file, but the saved file, in my case an image can not be seen or previewed. when I hit that url it returns default blank image from dropbox.

 

Please let me know, if any one look into my problem. Below is how I am using it.

 

PATH: /somefolder/somefile.extension

BODY: base 64 encoded string

 

Also I have some doubts about what should be send in body.

 

uploadFile: function(path, body, callback) {

options = {
method: "PUT",
url : "https://api-content.dropbox.com/1/"' + api.putFiles + "/auto/" + path,

headers: {
"Content-Length": getByteLength(body),
"Authorization": "Bearer " + access_token,
"Content-Type": "text-plain",

},
body:body
}
request(options, function(err, res, body) {
callback(err, res, body);
})
},

 

1 Reply 1

Re: File Upload

Dropboxer
Dropboxer
When uploading files, you should put the raw octet stream in the request body, not a base64 encoded string of the data.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?