Re: I'm confused about Regular Expressions.
| From: | php3 at developersdesk dot com | Date: | Wed, 21 Feb 2001 18:39:37 +0000 |
| Subject: | Re: I'm confused about Regular Expressions. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-41032@lists.php.net to get a copy of this message | ||
Addressed to: "Kenneth R Zink II" <Hellcat1@EV1.Net>
php-general@lists.php.net
** Reply to note from "Kenneth R Zink II" <Hellcat1@EV1.Net> Wed, 21 Feb 2001
11:42:28 -0600
>
> ------=_NextPart_000_00AC_01C09BFB.5E254010
> Content-Type: text/plain;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> I was just reading at DevShed on how to use Regular Expressions, but now =
> I'm even more confused.
>
> Can someone please explain how I would use a REGEX to determine in and =
> uploaded file is a .gif or .jpg file?
if( ereg( 'gif|jpg', $filename ))
Better yet, try doing a getImageSize() on the uploaded file, before you
move it and look at the [2] element of what is returned. This will give
you the actual type of file from inspecting its contents rather than
just trusting the extension that was typed.
http://www.php.net/manual/en/function.getimagesize.php
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com