Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I am not able to use the filesUpload endpoint with react native.
Simply because it is not possible with React Native to set the content type to one of the 'Content-Type' header accepted by the API. I get the following error:
Error in call to API function "files/upload": Bad HTTP "Content-Type" header: "application/octet-stream; charset=utf-8". Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack
Is there any workaround ?
I'm not alone with this problem:
https://github.com/square/okhttp/issues/3081
https://github.com/square/okhttp/blob/master/okhttp/src/main/java/okhttp3/RequestBody.java#L53
https://github.com/facebook/react-native/issues/14445
@Laurent22 Unfortunately I don't have any news on this from the team.
I have the same issue and after some hours fiddling around I was able to fix workaround it. I'm uploading a JSON file to a dropbox account and i used a TextEncoder like this:
var myFile_Encoded = new encoding.TextEncoder().encode(JSON.stringify(myFile)); dbx.filesUpload({ path: DBX_FILEPATH, contents: myFile_Encoded, mode: 'overwrite', });
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.Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on Twitter or Facebook.
For more info on available support options, see this article.
If you found the answer to your question, please 'like' the post to say thanks to the user!