File Upload length limit

Source: Internet
Author: User

Solution: Modify the Web. config file

1. Note that there are two Web. config files in MVC , such as one under views, which are used to control the files in the view, and one in the root directory, which works on all files. We modify the root directory under Web. config

2. Modify maxRequestLength: In Web. config We modify the maxRequestLength in <system.web></system.web> to indicate the maximum request length, in kilobytes, Default 4M

<system.web>     <!--maximum request length in kb-->     

3, modify maxAllowedContentLength: In the Web. config we modify <system.webServer></system.webServer> The maxAllowedContentLength, which represents the maximum attachment size, is in bytes and defaults to about 30M

<system.webServer>    <!--allow file length to be uploaded, in bytes---    <security>      <requestFiltering>        <requestlimits maxallowedcontentlength= "20971520"/>      </requestFiltering>    </security> </system.webServer>

Attention:

the difference between maxRequestLength and maxAllowedContentLength :

A, the former represents the request length, the latter indicates the size of the upload file;

b, the former unit KB, the latter unit bytes;

C, the former default value of 4M, the latter default value of 30000000B, about 30M;

D, the maximum value of both is 2G

File Upload length limit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.