Wrox Programmer Forums
|
BOOK: Beginning ASP.NET Databases Also see the forum ASP Databases for more general discussions of ASP database issues not directly related to these books.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 15th, 2006, 09:05 AM
Registered User
 
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Upload file size limitation in ASP.NET

Hi All,

    I am trying to upload files in my application using ASP.NET.
    I need to restrict the file size to 11 MB. But i am unable to restrict the size. I am trying to get the uploaded files count to check the file size in Application_BeginRequest event of Global.ascx.cs.

   I am not getting the uploaded files count. How to limit the file size in ASP.NET ?

  Can any one help me ? Its very urgent..


Thanks in Advance,
Natraj.

 
Old March 15th, 2006, 09:35 AM
Wrox Technical Editor
 
Join Date: Dec 2005
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Take a look at the ContentLength property.

Here's a tutorial of interest:
File Upload with ASP.NET: http://www.codeproject.com/aspnet/fileupload.asp

- A.Kahtava
 
Old March 15th, 2006, 10:05 AM
Registered User
 
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your quick response !

My problem.. If i try to upload more than maximum request length(I setup the max req length as 11264), it is throwing exception as Maximum Request Length has exceeded...

I am unable to catch that exception because the application is throwing at applciation begin request. It is not throwing at code behind of that page.

Now, Are you clear at my problem ?

Thanks Again,
Natraj.

 
Old May 7th, 2006, 12:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

How do u upload ur files?! if u do it manually & urself, I mean with the code u done, u can get the file size before uploan & restrict big files to be uploaded.

Tell me if u want the code to do it.

Always:),
Hovik Melkomian.
 
Old December 28th, 2006, 05:10 AM
Registered User
 
Join Date: Dec 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi melvik,
Please provide me the code to check the file size before uploading in ASP.NET. Scripting.FileSystemObject does not work under many other browsers and also sometimes does not work even in IE.
 
Old June 26th, 2007, 05:08 PM
Registered User
 
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Melvik, could you send me the code please.






Similar Threads
Thread Thread Starter Forum Replies Last Post
ch. 2 what is the file size limit to upload? cluce BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 February 19th, 2008 04:48 PM
Filter File Types in ASP.NET File Upload ramuis78 ASP.NET 2.0 Basics 2 May 31st, 2007 10:50 AM
file upload in ASP.net problem lpastor ADO.NET 1 September 15th, 2004 08:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.