Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Askillt Q.
9 years agoNew member | Level 1
Uploading issue , Please any one help me .
I am beginner in API Devlopment.
I am trying to upload images, document & files etc. on dropbox through V2 Rest Api method but falied.
Here is my Code
-----------------------------------------
var client = new RestSharp.RestClient("https://content.dropboxapi.com/2/files/upload");
var request = new RestRequest(Method.POST);
request.AddHeader("Dropbox-API-Arg", "{\"path\":\"/Medical Records/"+fileName+"\",\"mode\":{\".tag\":\"overwrite\"}}");
request.AddHeader("Content-Type", "application/octet-stream");
request.AddHeader("Authorization", "Bearer <AccessToken>");
request.AddFile("file", Server.MapPath("~/Content/60.jpg"), "image/jpg");
request.Timeout = System.Threading.Timeout.Infinite;
IRestResponse response = client.Execute(request);
After execution of above code getting this Error:
--------------------------------------------------------------------------------------------------------
Error in call to API function "files/upload": Bad HTTP "Content-Type" header: "multipart/form-data; boundary=-----------------------------28947758029299". Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cors-hack".
1 Reply
Replies have been turned off for this discussion
- Greg-DB9 years ago
Dropbox Community Moderator
Your HTTP client seems to be overriding the Content-Type you're trying to set. There was another thread with the same issue using RestClient here that should be helpful:
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!