Home > Backend Development > PHP Tutorial > php判断上传视频的真实格式,不是简单的用后缀来判断,怎么做到?

php判断上传视频的真实格式,不是简单的用后缀来判断,怎么做到?

WBOY
Release: 2016-06-06 20:06:41
Original
2843 people have browsed it

用php的post方式上传视频,怎么知道视频的真实格式?

回复内容:

用php的post方式上传视频,怎么知道视频的真实格式?

$_FILES['文件名']['type']或者

<code>$finfo = finfo_open(FILEINFO_MIME);
$mimetype = finfo_file($finfo, $inputFileName);</code>
Copy after login

都可以吧

后缀都可以改,一般确定一个文件的格式,是读取这个文件的前8个字节吧

取前8个字节进行判断比较靠谱。
不过某个格式对应的是什么就要你自己去测试了。

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template