Forum Moderators: phranque

Message Too Old, No Replies

Mime type of 3gp video files

3gp video files with application/octet-stream mime type

         

tfetfe

2:06 pm on May 28, 2018 (gmt 0)

5+ Year Member



I allow my users to upload videos to the website and each file is checked by a php script to see if it's a valid video file. This includes frame rate, resolution, video length, mime type.

A few days ago I got a message from one user that he can not upload 3gp video files from his mobile phone (3gp is default video format in his ZTE phone).

The mime type of 3gp files should be "video/3gpp" but in reality it's "application/octet-stream".

I tried:

$ftyp = mime_content_type($uploaded_file);


and

$finfo = new finfo;
$ftyp = $finfo->file($uploaded_file, FILEINFO_MIME_TYPE);


Both report that "application/octet-stream" is the mime type of 3gp video files.

My question are:

1) I am doing sometging wrong or 3gp files really have this mime type (or don't have any mime type at all).
2) How can I check these files to see that they are video files? If I allow to upload any "application/octet-stream" files, the users will be able to upload pdf, doc etc files that have the same mime type.

keyplyr

10:49 pm on May 28, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi tfetfe,

Can't you add another line of code to only allow certain file types?

tfetfe

11:58 am on May 29, 2018 (gmt 0)

5+ Year Member



Of course, I can add but... everyone can rename a php file to 3gp and upload to the server. Of course, mime type can be spoofed too and thatīs why I am chicking not only this criteria. But it looks strange to me that a relative new mobile phone produces videos without any mime type.