- Maximum File Size for Uploadbox
- Maximum File Upload Size in IIS
Contact Support
File Size
28 Jun 20173 minutes to read
Maximum File Size for Uploadbox
In the Uploadbox control, you can browse files with the size going up to gigabytes. You can restrict the files from being browsed using the fileSize property. When you do not use this property, it takes a default size, 31457280B, that is, 31MB.When this size exceeds, you cannot browse the file.
Add the following code example to the corresponding HTML page to render the Uploadbox control with the customized file size.
<div class="control">
<div id="Uploadbox" ej-uploadbox e-saveurl="save" e-removeurl="remove" e-filesize="1048576" e-error="fileuploaderror"></div>
</div>
Initialize the Uploadbox using the following code example.
angular.module('UploadboxApp', ['ejangular'])
.controller('UploadboxCtrl', function ($scope) {
$scope.save = "saveFiles.ashx";
$scope.remove = "removeFiles.ashx";
$scope.fileuploaderror=function (e, ui) {
alert(e.error);
}
});
The following screenshot displays Uploadbox control with customized file size.
When you want to browse the file within the fileSize, you can browse and upload the files.
When you try to browse the file with exceeded fileSize, we cannot browse and upload the files.
Maximum File Upload Size in IIS
By default, the IIS web server allows for limited file size to be uploaded to the web server. By default, Machine.config is configured to accept HTTP Requests up to 4096 KB, that is, 4 MB.
How to upload files up to 28.6 MB?
In order to allow larger file size uploads, such as above 4MB, you can override it by modifying the “maxRequestLength” attribute in the web application’s configuration file web.config. The property maxRequestLength indicates the maximum file upload size of 28.6MB, supported by ASP.NET. You cannot upload the files when the fileSize property is below the maxRequestLength value.
Property
Use-Case Description | Type | Maximum request size | Details |
---|---|---|---|
maxRequestLength | Property | 28.6 MB | Maximum request size supported by ASP.NET. |
Add the following code to your web.config file.
[web.config]
<configuration>
<system.web>
<httpruntime maxRequestLength="102400"/> //kilobytes
</system.web>
</configuration>
NOTE
maxRequestLength is measured in kilobytes.
How to upload the files above 28.6 MB?
The maxRequestLength property can be increased by modifying the “maxAllowedContentLength” attribute in the web application’s configuration file web.config. The default maximum length of the content in a request supported by IIS is around 28.6 MB or 30000000bytes.
Property
Use-Case Description | Type | Default value | Details |
---|---|---|---|
maxAllowedContentLength | Property | 28.6 MB | maxAllowedContentLength specifies the maximum length of content in a request supported by IIS. |
You can add the following code to your web.config file in order to set that value to 100 MB.
[web.config]
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="104857600" /> //bytes
</requestFiltering>
</security>
</system.webServer>
NOTE
maxAllowedContentLength is measured in bytes.
NOTE
- When you configure both maxAllowedContentLength, maxRequestLength attributes, then maxAllowedContentLength is considered for execution.
- When the upload file’s size exceeds maxAllowedContentLength, you get a 404.13 error page.
- When the upload file’s size exceeds maxRequestLength value, you get an exception “System.Web.HttpException: Maximum request length exceeded”.
- The ASP.NET method of maxRequestLength is greater than or equal to the IIS method of limiting the request length (maxAllowedContentLength).