Re: I'm confused about Regular Expressions.
| From: | Robin Vickery | Date: | Wed, 21 Feb 2001 21:16:55 +0000 |
| Subject: | Re: I'm confused about Regular Expressions. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41056@lists.php.net to get a copy of this message | ||
>>>>> "p" == php3 <php3@developersdesk.com> writes:
> 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 20= 01 11:42:28 -0600
>> ------=3D_NextPart_000_00AC_01C09BFB.5E254010 Content-Type:
>> text/plain; charset=3D"iso-8859-1" Content-Transfer-Encoding:
>> quoted-printable
>> Can someone please explain how I would use a REGEX to determine in
>> and =
> =3D
>> 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.
Or look at the mime type held in $HTTP_POST_FILES['uploadname']['type']
--
Robin Vickery.................................................
BlueCarrots, 14th Floor, 20 Eastbourne Terrace, London, W2 6LE