// check file type foreach($GLOBALS['allowedFileTypes'] as $thistype) { if ($_FILES['file']['type'] == $thistype) { $allowedFile = 1; break; } else { $allowedFile = 0; } } // illegal file type! if ($allowedFile != 1) { $last_message='MIMETYPE: ' . $_FILES['file']['type'] . ' Failed'; header('Location:error.php?ec=13&last_message=' . urlencode($last_message)); exit; }