Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I upload larger files with ASP.NET?

ASP.NET 101

How can I upload larger files with ASP.NET?

by  link9  Posted    (Edited  )
By default, the file size limit on uploads in ASP.NET is 4mb. Most of the time, the default 4Mb is more than enough to upload files using the POST method in webforms. But sometimes more is needed. The following example shows how.

To upload larger files through HTTP, you can use a configuration setting in your application Web config file or your machine Web config file:
Code:
<configuration>
    <system.web>
       <httpRuntime maxRequestLength="10000" />
       <authorization>
           <deny users="?"/>
       </authorization>
    </system.web>
</configuration>
where "10000" is the max file size in Kbytes that you want to allow.

This example was scraped from the following source:
http://www.dotnet4all.com/default.asp?NavID=514&NewsID=25&RubriekID=5&Dialog=NewsContent

They reported it coming from a newsgroup post.

And special thanks to member, TerryDad2, for cleaning up the solution a bit to get the capitalization correct.

Happy Coding! :)
Paul Prewett
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top