title: browse to image file then attach to PHP mail
body: <p>I'm not exactly a pro at this, so please forgive me for asking such a (probably) stupid question.  </p>
  
  <p>I need help setting up (on an html page) a method to allow a visitor to browse to a file (actually 2 files) on their computer that will be attached to a PHP mail form when they choose to submit.</p>
  
  <p>I know with the PHP mailing images, I will need to use something like PearMime or PHPMailer.</p>
  
  <p>*<strong><em>Update</em>*</strong></p>
  
  <p>Ok, now that I know how to put the HTML form to get the files.  When I use the following PHP, what am I doing wrong? I have 2 files requested from the HTML page by IDs (the HTML has both files correctly created), that is the location of the PHPMailer_5.2.1, the $mail->MsgHTML(file_get_contents('testfiles.html')); is actually looking at a html page I created at that location that just has a template starter for an html doc with the word Sample in the body.</p>
  
  <pre><code>&lt;?php
  
  require("PHPMailer_5.2.1/class.phpmailer.php");
  
  $mail = new PHPMailer(); //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch
  
  
  $file1 = $_REQUEST['file1'];
  $file2 = $_REQUEST['file2'];
  
  try {
    $mail-&gt;AddReplyTo('myemail@domain.com', 'FirstName LastName');
    $mail-&gt;AddAddress('myemail@domain.com', 'FirstName LastName');
    $mail-&gt;SetFrom('myemail@domain.com', 'FirstName LastName');
    $mail-&gt;AddReplyTo('myemail@domain.com', 'FirstName LastName');
    $mail-&gt;Subject = 'PHPMailer Test Subject via mail(), advanced';
    $mail-&gt;AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
    $mail-&gt;MsgHTML(file_get_contents('testfiles.html'));
    $mail-&gt;AddAttachment($file1);      // attachment
    $mail-&gt;AddAttachment($file2); // attachment
    $mail-&gt;Send();
    echo "Message Sent OK&lt;/p&gt;\n";
  } catch (phpmailerException $e) {
    echo $e-&gt;errorMessage(); //Pretty error messages from PHPMailer
  } catch (Exception $e) {
    echo $e-&gt;getMessage(); //Boring error messages from anything else!
  }
  
  
  ?&gt;
  </code></pre>