Forum Moderators: coopster
I usually check that the file extension is a .jpg, .png or .gif like this:
$filename = "picture.gif";
$extensions = array('.JPG', '.jpg', '.GIF', '.gif', '.png', '.PNG');
$ext = strrchr($filename, '.');
if (in_array($ext, $extensions))
{
//valid file type
}
else
{
//not valid
}
You can use other functions, but this one works ok for me. You can do the same with mime types. Store the allowable ones in an array, then check from there.
Hope that helps.
dc
it will return FALSE if your file is not a valid image