卸下html文件,输入“所有文件”选项 [英] Remove 'All Files' option from html file input

查看:345
本文介绍了卸下html文件,输入“所有文件”选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用<输入类型=文件方式> 上传音频文件

要做到这一点,我使用接受=音频/ *。正因为如此,浏览器的文件选择默认显示只有音频文件,但在该对话框中的选项所有文件

To do that I am using accept="audio/*". Because of this, file chooser of the browser shows only audio files by default, but there is an option 'All Files' in that dialog box.

(注意 - 在javascipt的,jQuery和AngularJs的任何解决方案,也欢迎)

(note - Any solution in javascipt , jquery and AngularJs is also welcome)

我如何可以禁用/删除所有文件的选项?

How can I disable/remove all files option?

推荐答案

我认为,这是浏览器的范围之内,更可达操作系统。然而,尽管无论情况下,我不认为这是东西,你应该惹无妨。

I believe that this is outside the scope of the browser, and is more up to the OS. However, despite whatever the case is, I don't think that this is something that you should mess with anyway.

接受没有最好的支持(虽然可能不是一个问题),但你可以在这里看到:<一href=\"http://www.iana.org/assignments/media-types/media-types.xhtml#audio\">http://www.iana.org/assignments/media-types/media-types.xhtml#audio允许类型的剪切次数大概落在你的应用程序的范围之外呢。你应该做的最好的事情是执行服务器端验证,使用接受纯粹是一个客户端的指标。

accept doesn't have the best support (although might not be an issue), but as you can see here: http://www.iana.org/assignments/media-types/media-types.xhtml#audio the shear number of allowed types probably falls outside of the scope of your application anyway. The best thing you should do is perform server side validation, using accept purely as a client indicator.

此外,虽然这是一个较旧的答案,我想它仍然是相关的,有效的:的文件输入'接受'属性 - 它是有用的

Also, while it is an older answer, I think it is still relevant and valid: File input 'accept' attribute - is it useful?

这篇关于卸下html文件,输入“所有文件”选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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