Hi,

Tuesday, July 30, 2002, 1:53:50 PM, you wrote:
D> This looks good but I just have one question about it if you don't mind,
D> what if someone was uploading a gif or a PNG file? can it be made to only
D> detect jpgs?
D> Thanks in advance
D> 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();
>> }

The $im[2] being set to 2 means it is a jpeg other image types have a
different number, have a look at the getimagesize()function for details




-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to