Safari< input type =" file"接受= QUOT;视频/ *">忽略mp4文件 [英] Safari <input type="file" accept="video/*"> ignores mp4 files

查看:428
本文介绍了Safari< input type =" file"接受= QUOT;视频/ *">忽略mp4文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < input type =fileaccept =video / *> 

允许我的用户上传视频到我的网站。这在所有现代浏览器(只允许用户选择视频文件)除Safari之外的预期。



从我可以告诉Safari似乎解释<$ c $忽略大部分(如果不是全部的话)其他视频格式/扩展名(如果不是全部),则忽略大部分视频格式/扩展名(webm,m4v等)。



有关如何让选择对话框只允许在Safari中使用普通视频文件类型(不仅仅是.mov)的建议?

解决方案

我发现以下接受字符串会将mp4和m4v添加到safari将接受的文件类型列表中: b
$ b

  accept =video / mp4,video / x-m4v,video / *

我不确定mime类型是用于webm视频的,但是如果你能查看,你应该能够将它粘贴到接受字符串上。诀窍是指定MIME类型,只是使用文件扩展名是行不通的。


I am using an HTML file input like this:

<input type="file" accept="video/*"> 

to allow my users to upload videos to my site. This works as expected in all modern browsers (only permitting the user to select video files) except Safari.

From what I can tell Safari seems to interpret the accept="video/*" attribute as accept="*.mov" ignoring most, if not all, other video formats / extensions (webm, m4v, etc).

Any suggestions on how to get the select dialog to allow only common video filetypes (not just .mov's) in Safari?

解决方案

I found that the following accept string will add mp4 and m4v to the list of file types that safari will accept:

accept="video/mp4,video/x-m4v,video/*"

I'm not sure what the mime type is for webm videos but if you can look that up you should be able to tack it on to the accept string. The trick is to specify the mime type, just using a file extension won't work.

这篇关于Safari&lt; input type =&quot; file&quot;接受= QUOT;视频/ *&QUOT;&GT;忽略mp4文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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