I have a task to allow uploads from an internal application that's built in .net5 razor pages of greater than 2gb per file. I have changed all the settings in the web.config and on server to allow these files to upload but still am greeted with a 400 error when trying.
<system.web>
<httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>
<requestFiltering>
<requestLimits maxAllowedContentLength="3147001541" />
</requestFiltering>
I am using the following to upload the files
var path = Path.Combine(targetFileName, UploadedFile.FileName);
using (var stream = new FileStream(path, FileMode.Create))
{
await UploadedFile.CopyToAsync(stream);
}
then after that it just saves the location in the DB of where that file was copied.