Unexpected end of MIME multipart stream in reading the second time in Web API

我与影子孤独终老i 提交于 2019-12-08 07:39:10

问题


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?

来源:https://stackoverflow.com/questions/46766263/unexpected-end-of-mime-multipart-stream-in-reading-the-second-time-in-web-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!