title: Attach File Through PHP Mail
body: <p>I am trying to get a custom contact form using PHP mail to have a user attach a photo, that then gets sent to the recipient outlined in the PHP mail code</p>
  
  <pre><code>&lt;input type="file" id="file" name="file"&gt;
  </code></pre>
  
  <p>The form code is as follows;</p>
  
  <pre><code>&lt;form action="register-mail.php" method="POST" enctype="multipart/form-data"&gt;
   &lt;input type="file" id="file" name="file"&gt;
   &lt;input type="submit" value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The PHP mail code is as follows;</p>
  
  <pre><code>&lt;?php $file = $_FILES['file'];
   $formcontent="Email Text Content";
   $recipient = "fake@email.com";
   $subject = "Here is a Photo";
   $mailheader = 'From: Basic Sign-up &lt;fake@email.com&gt;' . "\r\n";
   mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
  die();
  ?&gt;
  </code></pre>
  
  <p>I can't seem to get it to attach the file to the email being sent. What am I doing wrong?</p>