开发者

PHP different file type of same file in different browser

开发者 https://www.devze.com 2023-03-13 00:17 出处:网络
I am developing application in PHP which takes video file. I am giving serverside va开发者_开发问答lidation ($_FILES[\'file\'][\'type\']) that receive only .MP4 files.

I am developing application in PHP which takes video file. I am giving serverside va开发者_开发问答lidation ($_FILES['file']['type']) that receive only .MP4 files.

If i upload any MP4 file from Firefox browser then file type is 'application/octet-stream' and if i upload same file from Google Chrome then file type is 'video/mp4'.

If i upload any FLV file from Firefox then file type is also 'application/octet-stream' then how can i identify the file type of that video?


Have you tried using the file info library? finfo_file()

http://www.php.net/manual/en/function.finfo-file.php

it has a sister function mime_content_type()

http://www.php.net/manual/en/function.mime-content-type.php

0

精彩评论

暂无评论...
验证码 换一张
取 消