Menu
I’m not very good with PHP,
trying to add a little validation to my formmail script to only allow certain file extensions to be uploaded, using the script below, but even when uploading a file type thats on the whitelist, its executing the echo, can anyone tell me why?
[CODE]$filename = strtolower($_FILES[‘uploadfile’][‘name’]);
$whitelist = array(‘jpg’, ‘png’, ‘gif’, ‘jpeg’); #example of white list
if(!in_array(end(explode(‘.’, $fileName)), $whitelist))
{
echo ‘Invalid file type, image must be a JPG, PNG, GIF, or JPEG image!’;
exit(0);
}