Derin
Derin

Reputation: 2185

Setting file filter for AsyncFileUpload control

I would like to know how I can set a filter for the AsyncFileUpload control. For example, I would like only *.gif and *.jpg images to be shown. How can this be done.

Thanks in advance.

Upvotes: 0

Views: 2803

Answers (1)

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

Use RegularExpressionValidator

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

Upvotes: 1

Related Questions