| Quick Search |
If you want to validate your file extension on client site before upload the file. You can easily do this using regular expression Validator. Here’s the example to allow uploading only .jpg or .gif files. All you need is a FileUpload control and a Regular Expression Validator to check file type.
<asp:RegularExpressionValidator ID=”RegularExpressionValidator2″ ControlToValidate=”FileUpload1″ Display=”dynamic” runat=”server” ValidationExpression=”^.+(.jpg|.JPG|.gif|.GIF)$” ErrorMessage=”Upload a valid file”><asp:RegularExpressionValidator>
Posted in ASP.NET
You can follow any responses to this entry through the RSS 2.0 Feed. You can leave a response , or trackback from your own site.