Re: Is it possible to test an uploaded file to check the type?

From: Date: Sun, 13 Jul 2003 17:32:00 +0000
Subject: Re: Is it possible to test an uploaded file to check the type?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-155009@lists.php.net to get a copy of this message
The upload process, already collects info on file types when you upload. From the manual ->
$_FILES['userfile']['type']
    The mime type of the file, if the browser provided this
    information. An example would be "image/gif".
So, check $_FILES['userfile']['type'] against a set of allowed file types, and you're set...
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


« previous php.general (#155009) next »