Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
an wrong in dropbox api v2 document
curl -X POST https://content.dropboxapi.com/2/files/upload \ --header "Authorization: Bearer " \ --header "Dropbox-API-Arg: {\"path\": \"/Homework/math/Matrices.txt\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}" \ --header "Content-Type: application/octet-stream" \ --data-binary @local_file.png
when i set header
--header "Content-Type: application/octet-stream" \
=> can't send/ return error
but when i remove that header and add
--header "Content-Type: text/plain; charset=dropbox-cors-hack" \
=> return 200, succeed,
recheck: file was upload successful
When you say you "can't send/ return error", what's the error you get exactly?
Content-Type: application/octet-stream
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".
Error:400"
It seems that orther dev of dropbox fix it? (Edit: i think my code error when not send data in binary)
at that time the error return say
Expecting one of "application/octet-stream", "text/plain; charset=utf-8"
and when add two header
Content-Type: application/octet-stream (1)
Content-Type: text/plain; charset=dropbox-cors-hack (2)
=> return error
add only (1) or (2) => return success
Are you by any chance making an AJAX request and using Firefox?
There seems to be a known issue with Firefox where it adds the "charset=UTF-8".
Sorry, i think my code error when not read file in binary mode
-> server think a text -> return error utf-8
I'm having trouble following this thread.
Is your issue resolved? Or are you still having a problem?
I'm getting the same error message
Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack".
Fernando, can you start a new thread with the specific code you're having trouble with? That way we can help you in particular without spamming the others on this thread.
https://www.dropboxforum.com/hc/en-us/community/posts/new?community_post%5Btopic_id%5D=200209245
Thanks in advance!
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 X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!