Re: Re: need help with uploading images
| From: | Deadsam | Date: | Tue, 30 Jul 2002 03:53:50 +0000 |
| Subject: | Re: Re: need help with uploading images | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-110283@lists.php.net to get a copy of this message | ||
This looks good but I just have one question about it if you don't mind,
what if someone was uploading a gif or a PNG file? can it be made to only
detect jpgs?
Thanks in advance
Deadsam
> Try it this way, it will check if it is a jpeg and it has a horizontal
> and vertical size so you can be pretty sure it is an image file.
> (you do not need the gd package for getimagesize())
>
>
> /** Check for the type of the image : only allow jpeg's */
> $im = getimagesize($_FILES['uploadFile');
> if(!($im[2] == 2 && $im[0] > 0 && $im[1] > 0)){
> echo "You can only upload jpg images.";
> exit();
> }
>
>
>
>
> --
> regards,
> Tom
>