Wednesday, August 24, 2011

Asp.net Image validation.

In asp.net ,to validate the image extension you can use the regular expression like that.
<asp:RegularExpressionValidator ID="revImage" ControlToValidate="uplImage" ValidationExpression="^.*\.((j|J)(p|P)(e|E)?(g|G)|(g|G)(i|I)(f|F)|(p|P)(n|N)(g|G))$" Text=" ! Invalid image type" runat="server" /> 
Here the group of  image extension  array will check the extension and display the error message.

No comments:

Post a Comment