Unexpected end of MIME multipart stream in reading

2019-06-03 17:21发布

问题:

at first step I tried to read the contents into MultipartMemoryStreamProvider with the following code

 var multipartMemoryStreamProvider = await Request.Content.ReadAsMultipartAsync();

It solve my problem in getting the input File in memory.In this case I have access to other contents Key , but not value . I tried to get them with reading again the Contents into MultipartFormDataStreamProvider variable

string root = HttpContext.Current.Server.MapPath("~/uploads");
var provider = new MultipartFormDataStreamProvider(root);

Seems because I try to read the stream twice , it has the following error:

Unexpected end of MIME multipart stream. MIME multipart message is not complete

My first preference is to convert MultipartMemoryStreamProvider to MultipartFormDataStreamProvider

Is it possible to do that?