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
Post a Comment