c# - How to increase the max upload file size in ASP.NET?

If you are using IIS for hosting your application, then the default upload  size if 4MB. To increase it, please use this below section in your web.confg.
<configuration>
    <system.web>
        <httpRuntime maxRequestLength="4096" />
    </system.web>
</configuration>
"4096" is in KB.
For IIS7 and above, you also need to add the lines below:
 <system.webServer>
   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
   </security>
 </system.webServer>
Note: maxAllowedContentLength is measured in bytes while maxRequestLength is measured in kilobytes, which is why the values differ in this config example. (Both are equivalent to 1 GB.)

Comments

Popular posts from this blog

.NET Design Patterns Tutorial - MVC, MVP and MVVM Design Patterns

C# Coding Standards and Naming Conventions

What is the difference between C and C++?