ASP.NET中的文件筛选 [英] File Filtering in ASP.NET

查看:93
本文介绍了ASP.NET中的文件筛选的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在项目中使用文件上传控件.我只希望用户选择.doc文件.是否有任何方法可以过滤对其他类型文件的选择

谢谢

Nidhin

Hi
I''m using a file upload control in my project. I just want the user to select .doc files. Is there any methods to filter the selection of other types of files

Thanks

Nidhin

推荐答案

使用RegularExpressionValidator验证器并设置
Use a RegularExpressionValidator validator and set the
ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\


?)(\\(\w[\w].*))<br /> +(.doc|.DOC)
?)(\\(\w[\w].*))<br /> +(.doc|.DOC)


"


ControlToValidate 作为asp:FileUpload 控件,您需要验证

Cibin Jose


and ControlToValidate as the asp:FileUpload control you need to validate

Cibin Jose


这篇关于ASP.NET中的文件筛选的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆