如何使用xtype filefield(extjs 4.1.0)限制文件类型? [英] How to restrict file type using xtype filefield(extjs 4.1.0)?

查看:580
本文介绍了如何使用xtype filefield(extjs 4.1.0)限制文件类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用extjs 4.1.0实现文件上传功能。而我想限制用户只选择图像文件(jpg,png,gif)。有没有可以应用的过滤器,以便用户只能看到,然后选择上述文件的类型?

I am trying to implement file upload feature using extjs 4.1.0. Whereas I want to restrict users to select only image files(jpg,png,gif). Is there any filter which can be applied so that users will only be able to see and then select the types of the files mentioned above?

推荐答案

请参阅 http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.VTypes 自定义类型示例的VAlidation类型。您可以使用正则表达式来指定alphaMask。

See http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.VTypes VAlidation types for an example of a custom type. You could use a regexp to specify alphaMask as well.

这篇关于如何使用xtype filefield(extjs 4.1.0)限制文件类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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