简体   繁体   中英

Maximum request length exceeded error in file uploading

How to upload the 5mb pdf files using html upload button ?when I try upload the 5mb files I get Maximum request length exceeded error ?.This problem occurs because the default value for the maxRequestLength parameter in the section of the Machine.config file is 4096 (4 megabytes) .So I try to change webconfig file,

<configuration>
    <system.web>
         <httpRuntime maxRequestLength="102400" executionTimeout="1200" />
    </system.web>
</configuration>

If i use like this i got the An existing connection was forcibly closed by the remote host error. my project is hosted with IIS7 .So I try to,

<system.webServer>
   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="1048576" />
      </requestFiltering>
   </security>
 </system.webServer>

This way also not allow to upload the 5mb files? How to upload the 5 mb files through HTML Upload button?

trying adding a "0" To the end of your <requestLimits maxAllowedContentLength> value. I think it's in bytes, which means your example sets it to about 1MB.

Here's the doc on this setting .

If you are running this on a shared hosting account, chances are less that you will be able to resolve this. Due to limited resource allocation, hosting providers specify the timeout for a connection so if the connection takes too much time, it closes it.

My advice is, you should seek help of your hosting provider or try changing the host or plan.

Assuming this is your own server, if not see Murtuza Kabul. Try

requestLengthDiskThreshold="800000"

Btw I would recommend NeatUpload because the HTML Upload isn't very good in my opinion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM