What's the best way to discover a file's filetype within php? I heard that the browser may be tricked, so what's a better way of doing this?
You can use finfo_file
<?php echo finfo_file(finfo_open(FILEINFO_MIME), "foo.png"); ?>