Is there anything like !in_array()?
<p>$file_name = "smith.jpg" // This gives error 'Invalid file extension'
What could be the problem?</p>

<pre><code>$whitelist = array('jpg', 'png', 'gif', 'jpeg');

// Validate file extension
    if(!in_array(end(explode('.', $file_name)), $whitelist))
        HandleError('Invalid file extension');
</code></pre>
