Hi, I am using the below script to check if the uploaded file is pdf and send it with phpmailer to my email address. Everything works great. It validates and if not pdf it will show the 'PDF file only' message. However, I wanted the message to be in a list like my other errors. How do I achieve that? Thanks.

PHP Code:
<?php
    ob_start
();
    require(
"class.phpmailer.php");
    
    
$errors = array();
    if (
'POST' === $_SERVER['REQUEST_METHOD'])
    {
        
$fname           sanitize($_POST['fname']);
        
$lname           sanitize($_POST['lname']);
        
$email            sanitize($_POST['email']);
        
        if (empty(
$fname))
        {
            
$errors['fname'] = "Please provide first name.";
        }
        if (empty(
$lname))
        {
            
$errors['lname'] = "Please provide last name.";
        }
        if (!
filter_var($emailFILTER_VALIDATE_EMAIL))
        {
            
$errors['email'] = "Please provide a valid email address.";
        }

        
$files = array();
        
$upload $_FILES['upload']['tmp_name'];
        foreach(
$upload as $uploaded){
          if(!empty(
$uploaded)) {
        if(isset(
$uploaded)){
        
$finfo finfo_open(FILEINFO_MIME_TYPE);
        
$mimefinfo_file($finfo$uploaded);
        switch(
$mime) {
            case 
'application/pdf':
            break;
            default:
            die (
"PDF file only.");
              break;
        }}}}
    
        if (
count($errors) === 0)
        {
        
        
$message 'some message';
   
        
$mail = new PHPMailer();

        
$mail->SetFrom($email);
        
$mail->AddAddress($from);

        
$mail->Subject  "Subject";
        
$mail->Body     $message;
        
$mail->WordWrap 50;

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

        
$mail->Send();
        
        
header("Location: thankyou.php");
           exit();     
    
        }}

function 
sanitize($value)
    {
        return 
trim(strip_tags($value));
    }


?>