Pradip
Pradip

Reputation: 1327

PHP different file type of same file in different browser

I am developing application in PHP which takes video file. I am giving serverside validation ($_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?

Upvotes: 0

Views: 766

Answers (1)

BobGneu
BobGneu

Reputation: 1612

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

Upvotes: 3

Related Questions