Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Askillt Q.'s avatar
Askillt Q.
New member | Level 1
9 years ago

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".

About Dropbox API Support and Feedback

Node avatar for 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!