Link to home
Start Free TrialLog in
Avatar of fevster
fevster

asked on

regular expression validation for file extensions

Hi,

I need to use a regular expression validator in ASP.NET to check the file extension of a file input html control.

<input type="file" >

I am uploading images to the server and need to check for .jpeg,.jpg,.bmp and .gif.

Can anyone help?

Kev
Avatar of glsac
glsac
Flag of United States of America image

src[^>]*[^/].(?:jpg|bmp|gif)(?:\"|\')
Avatar of fevster
fevster

ASKER

This is my validator for my form. what so I place in the ??? bit. the line you placed above?

<asp:RegularExpressionValidator Runat="server" Display="None" ControlToValidate="uploadFile" ValidationExpression="????" ErrorMessage="Need correct image format" ID="Regularexpressionvalidator1" />

Thanks
ASKER CERTIFIED SOLUTION
Avatar of glsac
glsac
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial