I would create a new function to check the type:
function check_file_type($ext, $mime)
{
$allowed_types = array(
'jpg' => 'image/jpeg',
);
$ext = strtolower($ext);
return (array_key_exists($ext, $allowed_types) && $allowed_types[$ext] == $mime);
}
then replace the line:
if (($ext == "jpg") && ($_FILES["uploaded_file"]["type"] == "image/jpeg") &&
with
if (check_file_type($ext, $_FILES["uploaded_file"]["type"]) &&