当前位置: 动力学知识库 > 问答 > 编程问答 >

Unable to Upload 4 Gb File in asp.net

问题描述:

I would like to upload 4 Gb file in asp:fileupload control. When i try to upload 4gb file its seems "Unable to connect" and the same thing work for me when upload happens with 2 Gb file.

I have done some changes in web config file. As shown below :

For 4gb file,

httpRuntime maxRequestLength="4194304" executionTimeout="36000"

For 2gb file,

httpRuntime maxRequestLength="2097152" executionTimeout="18000"

Note : Using .Net Framework as 4.0

网友答案:

You have to change your web.config for upload this size of files. By default, IIS web server allows for limited file size to be uploaded to the web server. For IIS 6 and IIS 7, the default maximum file upload size is 4 MB and 28.6 MB respectively. IIS 7 returns a 404 error (HTTP Error 404.13 - CONTENT_LENGTH_TOO_LARGE) if someone uploads something larger than 30MB. In order to allow for larger file size uploads, a few server changes are required.
You can increase the maximum file size by modify the maxAllowedContentLength setting in the web.config file:

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

With the above maxAllowedContentLength, users can upload files that are 2 GB in size. This setting will work right away without restart IIS services.

网友答案:

There may be another factor with hardware, when we upload a file through asp file control first data will be saved into RAM then it will copy to the target location. I heard this in some training session but right now i don't have any references. In your case its able to store 2GB in RAM but there may not have enough space store 4GB data.

More over it's not suggestible to use asp file upload control, even tough it's worked in your local but it will crash when multiple users uploads huge files at a time. so better look alternative like HTML5 or something else to send the file to server by splitting into smaller chunks.

分享给朋友:
您可能感兴趣的文章:
随机阅读: