Click here to Skip to main content
15,921,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all i have been trying to post files for a third party tool through rest api with MultipartFormDataContent. Even though i am writing files to MultipartFordatacontent in byte arry i am receiving error saying "400 bad request no filedata section found in multipart post request".


Method: POST, RequestUri: 'url', Version: 1.1, Content: System.Net.Http.MultipartFormDataContent, Headers:

Content-Type: multipart/form-data; boundary="4c10d3d0-f2ac-467e-9b46-3ca172eb646d"
Content-Length: 185
Content-Disposition: form-data; name=filedata; filename=pp.txt
Content-Type: text/plain

test file

StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
x-transaction-id: 99999_fileuploaddownload_staging_1537571048380:f4e44b3ca701:28:jm91oq79:10113
vary: accept-encoding
Connection: keep-alive
Cache-Control: no-cache
Date: Fri, 21 Sep 2018 23:04:08 GMT
Content-Length: 104
Content-Type: application/json; charset=utf-8
{"statusCode":400,"error":"Bad Request","message":"No filedata section found in multipart POST request"}

What I have tried:

I Have tried Memory Stream, Byte array Multipartcontent,
Afzaal Ahmad Zeeshan 22-Sep-18 2:57am    
Can you check what type of data they expect? It is quite difficult to tell what the server is expecting to get with little information.
Richard Deeming 25-Sep-18 13:06pm    

The boundary doesn't seem to match the header. Can you update your question to show the code you're using to generate and send the request?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900