You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
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
- Greg-DBDropbox Staff
When you say you "can't send/ return error", what's the error you get exactly?
- Trương K.New 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.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".
- aaqrabawNew 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 ?
- Greg-DBDropbox Staff
aaqrabaw There's a post here that should be helpful:
https://stackoverflow.com/questions/33902289/using-dropbox-v2-api-from-browser/34168434#34168434
- Trương K.New 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.Dropbox Staff
I'm having trouble following this thread.
Is your issue resolved? Or are you still having a problem?
- Fernando M.9New member | Level 1
I'm getting the same error message
Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack".
- iosenqaExplorer | Level 4
Me to facing the same issue. ( https://www.dropboxforum.com/t5/API-Support-Feedback/Unable-to-upload-the-file-via-API/m-p/331068#M21073 )
- Greg-DBDropbox Staff
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!
- hintoNew 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-DBDropbox StaffHi 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:
https://www.dropboxforum.com/t5/forums/postpage/board-id/101000014
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,919 PostsLatest Activity: 13 hours ago
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 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!