tye commented on a Page, Upload File  -  Dec 31, 2006

It\'s not always a good idea to rely on $_FILES[][\'type\'] because this is simply the MIME type the client browser has given. This can potentially be faked by a client and browsers can also report the incorrect MIME type or give a generic MIME type.

You can use the getimagesize() function to get the MIME type of an image:

list($x,$x,$mime_type) = getimagesize($_FILES[\'files\'][\'tmp_name\']);

if ($mime_type == \'image/jpeg\' || $mime_type == \'image/gif\' || $mime_type == \'image/png\') {
....

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.