, - . , PECL , , , , , . . , -
http://www.garykessler.net/library/file_sigs.html
- for file signatures (or magic bytes or what they call now). You know what types of files you are going to accept, so just scan the incoming file for a set of signatures.
Another option is to let PHP run the unix shell and use the command filewith the appropriate flags to check your file and get the true mime type based on the actual contents of the file.
source
share