Stefan Steiger
Stefan Steiger

Reputation: 82136

Setting the filetype in ASP.net fileupload

Is it possible to limit the asp.net fileupload dialog to view only XML files? (Filer, .xml only)


Note: Not to check whether the extension is .xml, but to actually only let the user view xml files in the dialog.

Upvotes: 1

Views: 1149

Answers (2)

sashaeve
sashaeve

Reputation: 9607

Unfortunately you cannot set a filter for the file browser dialog - you have to use JavaScript or server-side validation for extension.

Upd. You can use RegularExpression validator with the following regex string:

@"(.*?)\.(jpg|jpeg|png|gif)$"

Upvotes: 0

Adeel
Adeel

Reputation: 19228

It is not possible.

Upvotes: 2

Related Questions