upload a video with dotnet getting malformed multipart body

zainzafar91
Visitor
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, "https://shopify-video-production-core-originals.storage.googleapis.com");
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)

zainzafar91
Visitor
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

 

Liam
Shopify Staff
2731 298 769

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 Shopify.dev or the Shopify Web Design and Development Blog

zainzafar91
Visitor
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.