Uploading files in ASP.NET core is largely the same as standard full framework MVC, with the large exception being how you can now stream large files. We will go over both methods of uploading a file in ASP.NET core.
I wrote a post Uploading files in ASPNET Core on PureSourceCode to explain in detail the code.
When you run the app, you have the following screen to try different scenarios.
The first implementation is for uploading large files reasding the content from the Request
. To use this version, you have to use Postman or CURL.
In the second implementation, the file is passed as IFormFile
. To upload the file from Swagger, we have to add a proper filter SwaggerFileOperationFilter
.