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…