Re: Re: Eregi for Image

From: Date: Sun, 26 Aug 2001 21:55:29 +0000
Subject: Re: Re: Eregi for Image
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-64547@lists.php.net to get a copy of this message
The filename solution might not be your best bet. They could've uploaded an mp3 which is simply named metallica.mp3.jpg. A call to getimagesize would allow you to verify if it is indeed a valid image file. /* Chris Lambert, CTO - chris@whitecrown.net WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */ ----- Original Message ----- From: <jimw@apache.org> To: <php-general@lists.php.net> Sent: Sunday, August 26, 2001 5:32 PM Subject: [PHP] Re: Eregi for Image | Jeff Oien <jeff@webdesigns1.com> wrote: | > I want to check if an uploaded file is an image. This isn't working. | > Could anyone help me out? | > | > if (!eregi("\\.gif$", $img1_name) || | > !eregi("\\.jpg$", $img1_name) || | > !eregi("\\.jpeg$", $img1_name)) { | > error message | > } | | unless you expect the file to have three extensions at once, you | probably mean && for each of the places you wrote ||. | | or you could do this: | | if (!ereg("\\.(gif|jpe?g)$", $img1_name)) { | error message | } | | jim | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net | For additional commands, e-mail: php-general-help@lists.php.net | To contact the list administrators, e-mail: php-list-admin@lists.php.net | | |

« previous php.general (#64547) next »