Filter File extension With FileUpload

To select images in fileupload control..

hope it will help you

asp:RegularExpressionValidator ID="rexp" runat="server" ControlToValidate="fupProduct"
     ErrorMessage="Only .gif, .jpg, .png, .tiff and .jpeg"
     ValidationExpression="(.*\.([Gg][Ii][Ff])|.*\.([Jj][Pp][Gg])|.*\.([Bb][Mm][Pp])|.*\.([pP][nN][gG])|.*\.([tT][iI][iI][fF])$)"></asp:RegularExpressionValidator

You can try the below code.

<asp:FileUpload ID="UploadFile" accept="image/*" multiple="false" runat="server" BorderStyle="None" />

It works with modern browsers.

Do not forget to validate the extensions using code behind procedures.


I believe it is not possible.Filter by file type in browser is not control by asp.net.It is a browser functionality.

This question already asked in stackoverflow.Please click filter the file type with the file upload control