PHP - Checking file types
<p>I have written a little bit of code for checking a file input for the extension and only letting through if its allowed but it doesnt seem to be working.</p>

<p>I call the function by using the following:</p>

<pre><code>$vcFileType = check_filetype($HTTP_POST_FILES['cv']['name'],"That filetype isnt allowed punk",array('doc','docx','pdf'));
</code></pre>

<p>and the function is as follows:</p>

<pre><code>function check_filetype($file, $problem='', $types){
    $fileExt = substr($file, strrpos($file, '.') + 1);
    if(in_array($fileExt, $types)){
        show_error($problem);
    }
    return $file;
}
</code></pre>

<p>If someone could let me know where im going wrong, that would be grand.</p>

<p>Cheers,</p>
