How to handle files in MultipartFormDataContent in .NET Core WebApi

How to handle files in MultipartFormDataContent in .NET Core WebApi In the previous article (How to handle MultipartFormDataContent in .NET Core WebApi), we described how to handle MultipartFormDataContent in .NET Core WebApi in the simplest way. Based on the framework-level encapsulation, we can quickly get the file content and text content respectively from Request.Form, but these default parsing methods are built and parsed in standard data formats on the front and back ends. Problem Description The example above shows the Request content received by the corresponding backend interface when the user sends a request through the IOS client. From the overall result of the request content, we can see that this is a multipart/form-data data format. Since this data is composed of multiple multipart sections, we can see that the request body contains 3 section, name values ​​are Agree, CultureCode, FingerSignature respectively. Each section will contain a Content-Disposition field. The first two sections are ordinary data formats, and the last one is image type data. When the backend interface receives such a request body and tries to use Request.Form.Files to obtain the target file, it is found that the file content corresponding to FingerSignature cannot be obtained. Problem Analysis Through…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索