title: Add a filetype validation to phpmailer?
body: <p>I have a phpmailer that attaches files by looping through an array of files from an file input field. How can i make it so that onl PDF or DOC are allowed. And if something else is attempted, the script stope and gives an error: "File type not supported. Only PDF or DOC."</p>
  
  <p>Any suggestions? Heres my current script;</p>
  
  <pre><code>foreach(array_keys($_FILES['files']['name']) as $key) {
          $source = $_FILES['files']['tmp_name'][$key];
          $filename = $_FILES['files']['name'][$key];
          $mail-&gt;AddAttachment($source, $filename);
  }
  </code></pre>