I am not sure if my exif_imagetype is coded wrong. It send the email just fine with photos attached. But when I try to attach non image files I am not getting the error message and it still send the email to me. Please help.

PHP Code:
ob_start();
require(
"class.phpmailer.php");

    
$photo $_FILES['photo'];

    isset(
$_POST['submit']);
$active_keys = array();
foreach(
$_FILES[$photo]['name'] as $key => $filename){
if(!empty(
$filename)){
    
$active_keys[] = $key;
}    }

foreach(
$active_keys as $key){    
switch(
exif_imagetype($_FILES[$photo]['tmp_name'][$key])) {
case 
IMAGETYPE_JPEG:
case 
IMAGETYPE_PNG:
    break;
    default:
 echo 
"{";
 echo        
"$errors: 'This is no photo..'\n";
 echo 
"}";
  exit(
0);
    } }
$message "some message";
$mail = new PHPMailer();
$mail->From     = ('sample@youdomain.net');
$mail->AddAddress=('sample@youdomain.net');
$mail->Subject  "Submitted Photos";
$mail->Body     $message;
$mail->WordWrap 50;

foreach(
$_FILES['photo']['tmp_name'] as $photo
if(!empty(
$photo)) {
     
$mail->AddAttachment($photo);
}

$mail->Send();


header("Location: thankyou.php");
   exit();     
   }}