Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

upload a video with dotnet getting malformed multipart body

3 0 0

Using the below code snippet to upload video. but getting malformed multipart body error. Any help


var request = new HttpRequestMessage(HttpMethod.Post, "");
var content = new MultipartFormDataContent();
foreach (var param in parameters)
content.Add(new StringContent(param.Value), param.Name);
using (var fileStream = new FileStream(filePath, FileMode.Open,
FileAccess.Read, FileShare.Read))
content.Add(new StreamContent(fileStream), "file","xyz.mp4");
request.Content = content;
var response = await client.SendAsync(request);
// response.EnsureSuccessStatusCode();
var result = await response.Content.ReadAsStringAsync();

Replies 3 (3)

3 0 0

It is working on postman just fine but when i try to upload from my dot net application i get this error


Shopify Staff
2626 282 719

If it's working as expected on Postman, it does sound like there could be some configuration issue on dot net - or if the video is very large it's possible the request is timing out and causing this issue?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit or the Shopify Web Design and Development Blog

3 0 0

I have increased the time out still the same issue. I cant think of any other configuration can you point me in some direction.