The upload process, already collects info on file types when you upload. From the manual ->
$_FILES['userfile']['type']So, check $_FILES['userfile']['type'] against a set of allowed file types, and you're set...
The mime type of the file, if the browser provided this information. An example would be "image/gif".
Marek Kilimajer wrote:
If you have compiled php with --enable-mime-magic, you can use mime_content_type()
Dan Anderson wrote:
Is it possible to check a file in $_FILES['userfile']['tmp_name'] to make sure it is of a certain format? I want to allow a user to only upload jpegs or mpegs, and want to check what format the file is in.
Thanks in advance,
Dan Anderson
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php