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: 
Highlighted

Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack".

Explorer | Level 3

I am using MultipartEntityBuilder to create Entity in java. MultipartEntityBuilder needs boundary value to be set. but dropbox is not allowing it to send.

 

when i do that, i m getting below error.

 

Error in call to API function "files/upload": Bad HTTP "Content-Type" header: "text/plain; boundary=dRUj2TWABj74JeYRtJ2MYFIjWDyjWrAaMQE". Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack".

 

could anyone please help ?

1 Reply 1
Highlighted

Re: Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-ha

Dropboxer
Dropboxer

The Dropbox API does not accept multipart requests, so you should not use MultipartEntityBuilder when constructing Dropbox API calls.

For information on what is expected for a call /2/files/upload, please refer to the documentation:

https://www.dropbox.com/developers/documentation/http/documentation#files-upload

As linked there, that endpoint is a "content-upload" style endpoint:

https://www.dropbox.com/developers/documentation/http/documentation#content-upload-endpoints 

The data for the file you're uploading should be sent in the request body, with a "Content-Type" header or "application/octet-stream" of "text/plain; charset=dropbox-cors-hack". (The first one is preferred.)

If you're using Java though, we recommend using the official Java SDK, which will do most of the work for you:

https://github.com/dropbox/dropbox-sdk-java

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?