note 124447 rejected from function.finfo-open by cmb

From: Date: Wed, 27 Nov 2019 16:59:39 +0000
Subject: note 124447 rejected from function.finfo-open by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213273@lists.php.net to get a copy of this message
Note Submitter: pelister at techlister dot com ---- I have the following content saved as a gif file, GIF89a< <?php echo "hello"; and I checked for valid image types using the following PHP functions <?php $finfo = finfo_open(FILEINFO_MIME_TYPE); foreach (glob("*") as $filename) { echo $filename . ": " . finfo_file( $finfo, $filename ) . "<br>"; echo $filename . ": " . mime_content_type( $filename ) . "<br>"; echo "exif: " . exif_imagetype( $filename ) . "<br>"; print_r( getimagesize( $filename ) ); echo "<br>"; } finfo_close($finfo); ?> I got the following output motion.gif: image/gif motion.gif: image/gif exif: 1 Array ( [0] => 2620 [1] => 16188 [2] => 1 [3] => width="2620" height="16188" [channels] => 3 [mime] => image/gif ) none of the functions determine if the uploaded image is valid.

« previous php.notes (#213273) next »