File type of a file in an archive


#1

Hi there,

is it possible to check the file type/ extension of an uploaded file that is in an archive with php? So that you can ban file types like .exe.

Thanks


#2

You could use mime_content_type() http://us2.php.net/mime_content_type or the newer finfo_file() http://us2.php.net/manual/en/function.finfo-file.php

These will (should) give you mime information to determine what you need.

Also you should actually consider checking the name of the file (for the obvious exe, etc…) as well. You could use regular expressions, substrings, etc… to do this.