如何提高ASP.NET中的最大上传文件的大​​小?上传文件、最大、ASP、NET

2023-09-02 01:18:15 作者:小姐,你是胸手

我有节选的文件上传在ASP.NET表单。我需要增加最大上传大小上述4 MB的默认值。

I have a form that excepts a file upload in ASP.NET. I need to increase the max upload size to above the 4 MB default.

我发现在某些地方引用了以下code在msdn.

I have found in certain places referencing the below code at msdn.

[ConfigurationPropertyAttribute("maxRequestLength", DefaultValue = )]

无参考文献的实际描述如何使用它,我已经试过几件事情没有成功。我只希望修改此属性为所要求的文件上传某些页面。

None of the references actually describe how to use it, and I have tried several things with no success. I only want to modify this attribute for certain pages that are asking for file upload.

这是正确的路线走?我如何使用它?

Is this the correct route to take? And how do I use this?

推荐答案

本设置进去你的web.config文件。它会影响整个应用程序,虽然...我不认为你可以为每个页面设置。

This setting goes in your web.config file. It affects the entire application, though... I don't think you can set it per page.

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="xxx" />
  </system.web>
</configuration>

XXX是KB。默认值是4096(= 4 MB)。

"xxx" is in KB. The default is 4096 (= 4 MB).