I want to add multiple streams into my MultiformDataContent and I'm doing it like this:
MultipartFormDataContent formdata = new MultipartFormDataContent();
foreach (var item in files)
{
using (FileStream fs = File.Open(item, FileMode.Open, FileAccess.Read))
{
HttpContent content = new StreamContent(fs);
formdata.Add(content, "files", item.Split(charSeparators)[2]);
}
}
// send the content to the backend, parse results
var result = client.PostAsync(url, formdata).Result; // ObjectDisposedException
but when I check my content length, it's null and the ObjectDisposedException is thrown.