Upload Large File is null


if I try to upload a larger file for example > 50 MB the IFormFile[] files is null in the upload controller on server side?


ASP.NET has a limitation of max request file size which can be extended via settings.


The last entry worked for me. It is for hosting with IIS. In Visual Studio while debugging you have to use IIS Express.

  1. Add the web.config file to your project and then add the following code there:
<?xml version="1.0" encoding="utf-8"?>
                <!-- Handle requests up to 1 GB -->
                <requestLimits maxAllowedContentLength="1073741824" />
  1. Set up the Form Options and IIS Server Options in your Startup.cs file like this:
 services.Configure<IISServerOptions>(options =>
     options.MaxRequestBodySize = int.MaxValue;

 services.Configure<FormOptions>(o =>
     o.ValueLengthLimit = int.MaxValue;
     o.MultipartBodyLengthLimit = int.MaxValue; 
     o.MultipartBoundaryLengthLimit = int.MaxValue;
     o.MultipartHeadersCountLimit = int.MaxValue;
     o.MultipartHeadersLengthLimit = int.MaxValue;
     o.BufferBodyLengthLimit = int.MaxValue;
     o.BufferBody = true;
     o.ValueCountLimit = int.MaxValue;