I\'m programming something that allows users to store documents and pictures on a webserver, to be stored and retrieved later. When users upload files to my server, PHP tells m
On a unix system, capturing the output from the 'file' command should provide adequate info.
Magic number. If you can read first few bytes of a binary file you can know what kind of file it is.
Check out the FileInfo PECL extension for PHP, which can do the MIME magic lookups for you.