[英]Detect WebM mime type in PHP with Fileinfo
My code use the FileInfo extension to detect file mime-type. 我的代码使用FileInfo扩展名来检测文件的mime类型。
$finfo = new finfo();
$mimetype = $finfo->file($filename, FILEINFO_MIME);
This works well for most files I tested. 这对我测试的大多数文件都适用。 However, it doesn't works for WebM file.
但是,它不适用于WebM文件。 I understand that FileInfo uses a magic file database.
我了解FileInfo使用魔术文件数据库。 The same than the one used by the
file
command which is also unable to detect WebM mime type (on the same system). 与
file
命令使用的命令相同,该命令也无法检测WebM MIME类型(在同一系统上)。
I guess it should be possible to add WebM support to this magic file , but how? 我想应该可以向该魔术文件添加WebM支持,但是如何?
这是文件格式的正式定义: http : //www.optimasc.com/products/fileid/magic-format.pdf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.