title: phpmailer received email but not attachment
body: <p>I am using the below script to allow user to upload images and email it to me. I did received the email but the attachment is not included in the email. It also show the from email as root user instead of the user's email address. please help.</p>
  
  <pre><code> &lt;?php
  ob_start();
  require("class.phpmailer.php");
  
  $salutation        = $_POST['salutation'];
      $firstname         = $_POST['firstname'];
      $lastname          = $_POST['lastname'];
      $email             = $_POST['email'];
      $photo             = $_FILES['photo'];
  
  isset($_POST['submit']);
  $active_keys = array();
  foreach($_FILES[$photo]['name'] as $key =&gt; $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        "error: 'This is no photo..'\n";
      echo "}";
      exit(0);
  } }
  $message = "Photo submitted by: $salutation $firstname $lastname.  &lt;br&gt;Comments: $comments.&lt;br&gt;terms:$terms.";
  
  $mail = new PHPMailer();
  
  $mail-&gt;From     = ($email);
  $mail-&gt;AddAddress('info@domain.com');
  
  $mail-&gt;Subject  = "Submitted Photos";
  $mail-&gt;Body     = $message;
  $mail-&gt;WordWrap = 50;
  
  foreach($FILES['photo']['tmp_name'] as $photo) {
  if(!empty($photo)) {
      $mail-&gt;AddAttachment($photo);
  }}
  
  $mail-&gt;Send();
  
  header("Location: thankyou.php");
     exit();     
  
  ?&gt; 
  </code></pre>