且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 HTML 文件输入中删除“所有文件"选项

更新时间:2023-12-04 20:40:16

我认为这超出了浏览器的范围,更多取决于操作系统.然而,不管情况如何,我认为无论如何都不应该把这件事搞砸.

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.

accept 没有***的支持(虽然可能不是问题),但正如您在此处看到的:http://www.iana.org/assignments/media-types/media-types.xhtml#audio无论如何,允许的类型可能不在您的应用程序范围内.您应该做的***的事情是执行服务器端验证,使用 accept 纯粹作为客户端指示器.

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 sheer 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?