File Size

7 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.

  • HTML
  • <div style="width:100px;height:35px;">
    <ej-uploadbox id="UploadDefault" [saveUrl]="saveURL" [removeUrl]="removeURL" [fileSize]="1048576" (error)="fileuploaderror($event)"></ej-uploadbox>

    Initialize the Uploadbox using the following code example.

  • HTML
  • import {Component} from '@angular/core';
        selector: 'ej-app',
            templateUrl: 'app/components/uploadbox/uploadbox.component.html'
        export class UploadBoxComponent {
            constructor() {
            this.saveURL = '../saveFiles.ashx';
            this.saveURL = '../removeFiles.ashx';
            fileuploaderror($event) {

    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.


    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.

  • C#
  • [web.config]
            <httpruntime maxRequestLength="102400"/> //kilobytes 


    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.


    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.

  • C#
  • [web.config]
                <requestLimits maxAllowedContentLength="104857600" /> //bytes


    maxAllowedContentLength is measured in bytes.


    • 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).