or, a bit more concisely, you could use a regexp...
to allow only jpg/gif/png file formats, setup the
regexp to match on those three formats, and
yell at people who submit anything other than
those three....
$imgName = "one.jpg";
if (! preg_match('/\.(jpg|gif|png)$/', $imgName) ) {
print "file format is not supported!";
}
> -----Original Message-----
> From: John Vanderbeck [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, February 17, 2001 08:27
> To: Alvin Tan; Php-General
> Subject: Re: [PHP] checking image extensions
>
>
> > Hi, Newbie question here. I'm trying to write a function to check an image
> > extension, part of the code is:
> >
> > if (substr($imgName, -4) != ".jpg")
>
> if ((substr($imgName, -4) != ".jpg") || (substr($imgName, -4) != ".gif"))
> {
> echo "<P CLASS=Error>I'm sorry, but the ikmage format you submitted is not
> a supported format.</P>";
> }
>
> - John Vanderbeck
> - Admin, GameDesign
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]