php - Error Message with fileinfo verification -


i getting error message using below infofile script verify if uploaded files pdf , send via phpmailer.

line 66 "default:" at. if delete default next line become error , on. not sure wrong script. can please help. thx.

parse error: syntax error, unexpected 'default' (t_default) in /test.php on line 66

if ($_files['upload']['error'] !== upload_err_ok) { die("upload failed" . $_files['upload']['error']); } $finfo = finfo_open(fileinfo_mime_type); $mime = finfo_file($finfo, $_files['upload']['tmp_name']); $ok = false; switch($mime) { case 'application/pdf' default:    die("not permitted file type");  $ok = true;     foreach($_files['upload']['tmp_name'] $uploadfile)      $mail->addattachment($uploadfile); }  

you've missed colon after first (non-default) case. should be:

switch($mime) { case 'application/pdf': //                    ^ default: 

additionally: i'm not sure want happen in first case, if that's allowed case should use break before default case. otherwise interpreter execute (or other cases after it).


Comments