All,
I have a grid; in that grid's edit form template i have placed one file upload control to upload image files.
To validate the file path and the file types i am using the following piece of code
<asp:FileUpload ID="ThumbNailUpload" runat="server" onkeydown="javascript: return cancelEnterKey (this, event)" onchange="" />
<asp:RegularExpressionValidator ID="FilePathRegExValidator" runat="server" ValidationExpression='^((?:[a-zA-Z]:)|(?:\\{2}\w[-\w]*)\$?)\\(?!\.)((?:(?![\\/:*?<>"|])(?)[\x20-\x7E])+\\(?!\.))*((?:(?:(?![\\/:*?<>"|])(?![..]$)[\x20-\x7E])+)\.((?:(?![\\/:*?<>"|])(?![ .]$)[\x20-\x7E])+))
ControlToValidate="ThumbNailUpload" ErrorMessage="Invalid File path." Text ...
Go to the complete details ...