Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Trương K.
10 years agoNew member | Level 1
Api v2 upload document wrong
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
13 Replies
Replies have been turned off for this discussion
- Greg-DB10 years ago
Dropbox Community Moderator
When you say you "can't send/ return error", what's the error you get exactly?
- Trương K.10 years agoNew member | Level 1
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 - Steve M.10 years ago
Dropbox Staff
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".
- Trương K.10 years agoNew member | Level 1
Sorry, i think my code error when not read file in binary mode
-> server think a text -> return error utf-8
- Steve M.10 years ago
Dropbox Staff
I'm having trouble following this thread.
Is your issue resolved? Or are you still having a problem?
- Fernando M.99 years agoNew member | Level 1
I'm getting the same error messageExpecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack".
- Greg-DB9 years ago
Dropbox Community Moderator
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!
- hinto9 years agoNew member | Level 2Was there a resolution to this? It looks like there's only 2 content-types I can send via the upload endpoint
- Greg-DB9 years ago
Dropbox Community Moderator
Hi Hinto, we haven't heard back from Trương on this thread, so we don't know if their issue was resolved.
Fernando opened a thread here:
https://www.dropboxforum.com/t5/API-support/Is-it-possible-to-pass-all-parameters-to-a-v2-API-request-in-URL/m-p/152792/highlight/true#M5099
If neither of these help in your case, please open a new thread with the details of the issue you're having so we can help. - aaqrabaw8 years agoNew member | Level 2
Hi Steve , i got an issue where content-type get rewite to charset=utf-8 , i'm using ajax and firefox , what is that known issue ? and how to solve it ?
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
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!