filetype() won't give you the information that you're looking for, and you should NEVER rely on the extension of a file to tell you what it is. For a long time people were able to execute code on visitor machines by writing javascript and vbscript into files that they saved with photo extensions. Then visitors browsers would open the file based on its contents rather than its extension and execute the code. This doesn't work any more for modern browsers but it's still a teachable moment. use fileinfo to get a better idea of file type http://www.php.net/manual/en/book.fileinfo.php