ASP.NET 2.0 FileUpload control tutorial

Posted by Steve on Feb 12, 2007 in ASP.NET |

In this tutorial I will show how to write C# code that handles the FileUpload control. We will use the RegularExpressionValidator control for client-side validation and introduce server-side validation methods when uploading specific file types.

coming soon…

5 Comments

Smitha
Jun 29, 2007 at 12:23 am

I need to validate the filename while browsing and uploading a file such tat,it should allow only .xls files


 
Steve
Jul 15, 2007 at 1:42 pm

Hi Smitha, you can use the RegularExpressionValidator control to check the uploaded file for the pattern “*.xls” and also check the ContentType property as “application/excel” in case someone just changes the file name extension and attempts to upload the file.


 
laura
Feb 8, 2008 at 1:38 pm

Is it possible to change it to where it only shows a specific file type when browsing? I am thinking I am going to have to make this my first ever custom control because I only want to see the .pdf files in the folders when I browse.


 
Nahuel
Oct 30, 2008 at 10:21 am

You are an asshole! Why you post an article you have’t write yet? Are you stupid or what??


 
Steve
Dec 12, 2008 at 9:21 pm

Hey Nahuel, sorry about not finishing the post. I’ve been trying to find a way to consolidate all my blogs/projects so I can maintain them more efficiently so I don’t piss off readers like you.


 

Reply

Copyright © 2009 Steven Ng All rights reserved. Theme by Laptop Geek.