Wednesday, August 8, 2007

How to Check upload file type using RegularExpressionValidator

You can check upload file type client side using RegularExpressionValidator as shown below

use ValidationExpression as follows

ValidationExpression="(.*\.([jJ][pP][gG]|[jJ][pP][eE][gG]|[pP][nN][gG]|[tT][iI][fF][fF])$)"

This expression restricts upload to the file type of .jpg, .jpeg, .tiff
you can edit validation expression as per your need.

No comments: