Check secure image upload
Is there still a way to upload a malicious file?


I think not, due to these elements:


The check of $image['type'] against an array of various image/* mime types prevents uploading a script instead of an image
The hashing of the filename with makeHash prevents uploading a script with a malicious path to get the file placed somewhere unintended
The check of $image['size'] against a defined maximum prevents uploading an oversized file



  What is your opinion of this code? 


Instead of this:


    if ($in == '')
    {
        return false;
    }



It would be better to add a default statement in the switch above it:

    switch ($image['type'])
    {
        // ...
        case 'image/wbmp':
            $in = 'imagecreatefromwbmp';
            break;
        default:
            return false;
    }


This seems pointless to me:


    if ($fileName == '')
    {
        return false;
    }



It seems to me that $fileName will always be set.