如何在 ASP.NET 中增加最大上传文件大小? [英] How to increase the max upload file size in ASP.NET?
问题描述
我有一个表单,除了 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.
我发现在某些地方引用了以下代码 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).
这篇关于如何在 ASP.NET 中增加最大上传文件大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!