简体   繁体   English

使用Fileinfo在PHP中检测WebM MIME类型

[英]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.

相关问题 在PHP 5.3.8上使用fileinfo进行Mime类型检测失败 - Mime type detection fails with fileinfo on PHP 5.3.8 来自PHP fileinfo的错误/不正确的ogv MIME类型 - Incorrect/undesirable ogv MIME type from PHP fileinfo 使用PHP检查上传时的mime类型的文件。 mime_content_type,fileINfo,linux文件不可用 - Check mime type of file on upload with PHP. mime_content_type, fileINfo, linux file NOT available PHP 5.3.5 fileinfo()MS Office 2007文件的MIME类型-magic.mime更新了吗? - PHP 5.3.5 fileinfo() MIME Type for MS Office 2007 files - magic.mime updates? Laravel“启用fileinfo扩展名后,由于没有可用的猜测器,因此无法猜测mime类型(是否启用了php_fileinfo扩展名?)” - Laravel “Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)” when fileinfo extension is enabled 在php中检测mime类型的正确方法 - Correct way to detect mime type in php 1/1)LogicException由于没有可用的猜测器,因此无法猜测mime类型(是否启用了php_fileinfo扩展名?) - 1/1) LogicException Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?) 即使在启用 php_fileinfo 后,我也会收到错误:无法猜测 MIME 类型 - Even after enabling php_fileinfo I get error:unable to guess mime type 为什么php没有正确检测到pdf mime类型(wkhtmltopdf)? - Why doesn't php correctly detect a pdf mime type (wkhtmltopdf)? 检测文件是否是PHP中没有mime类型的音频文件 - Detect if a file is an audio file in PHP without mime type
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM