Skip to content

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.

Notifications You must be signed in to change notification settings

erossini/ASPNETCoreUploadFiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASP.NET Core Upload big files

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.

Implementation for .NET Core 2.x and 3.x

When you run the app, you have the following screen to try different scenarios. image

Implementation for .NET 5.x or above

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. Call the API with Postman

In the second implementation, the file is passed as IFormFile. To upload the file from Swagger, we have to add a proper filter SwaggerFileOperationFilter. Change Swagger to upload file

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published