Max upload file size trên ASP.NET
Thông thường các website asp.net mặc định chỉnh cho phép các bạn upload file <= 2MB nếu bạn cần upload file lớn hơn các bạn làm theo hướng dẫn sau.
Dưới đây là cấu hình web.config dành cho IIS 7+
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="52428800" /> <!--50MB-->
</requestFiltering>
</security>
</system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="52428800" /> <!--50MB-->
</requestFiltering>
</security>
</system.webServer>
Nếu bạn dùng IIS6 thì sẽ có cấu hình web.config như sau:
<system.web>
<!-- maxRequestLength for asp.net, in KB -->
<httpRuntime maxRequestLength="15360" ></httpRuntime>
</system.web>
<!-- maxRequestLength for asp.net, in KB -->
<httpRuntime maxRequestLength="15360" ></httpRuntime>
</system.web>
Nếu trên IIS6 đã cấu hình web.config nhưng vẫn chưa được các bạn edit thêm file sau:
%windir%\system32\inetsrv\config\applicationhost.config
Edit lại dòng sau:
<requestLimits maxAllowedContentLength ="<length>" />
Chúc các bạn thành công.
Bình luận
Gửi