在html文件选择器对话框上创建过滤器 [英] Create filter on html file chooser dialog

查看:183
本文介绍了在html文件选择器对话框上创建过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在默认的文件选择器对话框中显示只有.xxx文件。
xxx可能不是已知的文件类型,例如abc,efg等。

我使用的是html5,所以它可能会有新的支持。 http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#attr-input-accept\">HTML 5 accept在文件输入元素上的属性就是为了这个目的。例如:

 < input type =fileaccept =。doc,.docx,.xml,application / msword,应用/ vnd.openxmlformats-officedocument.wordprocessingml.document> 


Is there a way to show only .xxx files in the default file chooser dialog. xxx may be not-known file types, such as abc, efg etc.

I'm using html5 so it may have new support for this type of things.

Thanks!

解决方案

The HTML 5 accept attribute on file input elements is for this purpose. E.g.:

<input type="file" accept=".doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document">

这篇关于在html文件选择器对话框上创建过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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