dotnet httpclient - C# multipart data uploading problems - InvalidOperationException -


i have problem posting files using multipartformdatacontent. try use filestream adding file content multipartformdatacontent

var multipartmetadata = new multipartformdatacontent(); var filestream1 = file.open("sample1.txt"); var filestream2 = file.open("sample2.txt");  multipartmetadata.add(new streamcontent(filestream1), filedata.name, filedata.filename);  multipartmetadata.add(new streamcontent(filestream2), filedata.name, filedata.filename);  var client = new httpclient();  await client.postasync(uri, multipartmetadata); 

invalidoperationexception thrown during execution code. exception message "cannot close stream until bytes written". there ideas how fix ?


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -