title: jquery send email with attachment
body: <p>i have one form which collect user information</p>
  
  <pre><code>Name
  Age
  CV
  </code></pre>
  
  <p>and then i submit that form via jquery to send email</p>
  
  <p>i have following code</p>
  
  <pre><code>var a= $('#a').attr('value');
  var b= $('#b').attr('value');
  
            $j.ajax({
              type: "POST",
              url: "sendemail.php",
              data: "a="+ a +"&amp;b="+ b,
              success: function(html){
                           .............
  </code></pre>
  
  <p>this function works file but i am unable to find a way to verify file as MSWORD or PDF and then attach and send email.</p>
  
  <p>and i am using php mail() function to send email</p>
  
  <pre><code>$Headers  = "MIME-Version: 1.0\n";
  $Headers .= "Content-type: text/html; charset=iso-8859-1\n";
  $Headers .= "From: ".$FromName." &lt;".$FromEmail."&gt;\n";
  $Headers .= "Reply-To: ".$ReplyTo."\n";
  $Headers .= "X-Sender: &lt;".$FromEmail."&gt;\n";
  $Headers .= "X-Mailer: PHP\n"; 
  $Headers .= "X-Priority: 1\n"; 
  $Headers .= "Return-Path: &lt;".$FromEmail."&gt;\n";  
          if(mail($ToEmail, $Subject, $Content, $Headers) == false) {
      echo "2";
          }
          else
          { 
          echo "1" ;
          }
  
  
  my basic question is:
  1. how to validate file (only MSWORD and PDF)
  2. send file to sendemail.php via AJAX to attach with email.
  </code></pre>
  
  <p>Thanks</p>