RSS

Asp Fileupload Control Allow only image files

25 Nov

alowing only image in file control you can use the following RegularExpressionValidator

<asp:FileUpload ID = “fuBannerImage” runat =”server” Width=”280px” style=”color:#999″ />

 

<asp:RegularExpressionValidator ID=”RegularExpressionValidator1″ runat=”server” ErrorMessage=”Only picture allowed!” ValidationExpression=”^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.png|.bmp|.gif|.GIF|.jpg|.JPG|.jpeg|.JPEG)$” ControlToValidate=”fuBannerImage” Display=”Dynamic”></asp:RegularExpressionValidator>

 

Advertisements
 
Leave a comment

Posted by on November 25, 2012 in ASP Dot Net C#

 

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: