|
Posted by Rik on 08/14/07 00:08
On Tue, 14 Aug 2007 01:51:41 +0200, macca <ptmcnally@googlemail.com> wro=
te:
> Hi thanks for the quick reply.
>
> You are right. it was the "type" causing it. I used print_r and it
> gave me this:
>
> Array ( [file] =3D> Array ( [name] =3D> DSCF0495.JPG [type] =3D> image=
/pjpeg
> [tmp_name] =3D> C:\WINDOWS\TEMP\php11.tmp [error] =3D> 0 [size] =3D>
> 115829 ) )
>
> The type was coming out as "image/pjpeg" for some reason.
>
>
> I changed it to this and it now works fine. Thanks.
>
>
> if(is_uploaded_file($_FILES['file']['tmp_name']))
> {
> print_r($_FILES);
> $img_mime_type =3D getimagesize($_FILES['file']
> ['tmp_name']);
> if(
> ($img_mime_type[2] =3D=3D IMAGETYPE_GIF) ||
> ($img_mime_type[2] =3D=3D IMAGETYPE_JPEG)||
> ($img_mime_type[2] =3D=3D IMAGETYPE_PNG)
> )
I'd use:
if($img_mime_type && ($img_mime_type[2] =3D=3D IMAGETYPE_GIF || =
$img_mime_type[2] =3D=3D IMAGETYPE_JPEG || $img_mime_type[2] =3D=3D IMAG=
ETYPE_PNG))
As getimagesize() will return false for something not recognized as an =
image.
-- =
Rik Wasmus
Navigation:
[Reply to this message]
|