title: Could not access file:....Sending pdf in a email attachment
body: <p>Im using php mailer class to send emails and it is working fine.</p>
  
  <p>But now im trying to send an attachment in my email and Im having an error.</p>
  
  <p>When I click in my button to send email I get my sucess message that email was sent with sucess but I also get this message "<strong>Could not access file: pdfName.pdf</strong>".</p>
  
  <p>In my file to send emails I have this <strong>php code</strong>:</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['sendForm'])){
      $subject = $_POST['subject'];
      $pdf = $_FILES['pdf']['name'];
  
  
      if(empty($subject) || empty($_FILES['pdf']['name'])){
          echo 'Please fill all fields';
      }
      else{
          $readSubscribers = $pdo-&gt;prepare("SELECT * FROM subscribers");  
          $readSubscribers-&gt;execute();
  
          if($readSubscribers-&gt;rowCount() &lt;=0){
              echo 'We dont have any subscriber yet.';    
          }
          else{
              while($result = $readSubscribers-&gt;fetch(PDO::FETCH_ASSOC)){
              $email  = $result['email'];
              $code = md5($code);
              $msg = 'email message';  
              sendMail($subject,$msg,MAILUSER,SITENAME,$email,'',$pdf);
              }
              echo 'Email sent with sucess.';
          }
      }
  }
  ?&gt;
  </code></pre>
  
  <p>And this is <strong>my html</strong>:</p>
  
  <pre><code>&lt;form name="editpost" method="post" enctype="multipart/form-data"&gt; 
      &lt;div&gt;
          &lt;span&gt;Subject:&lt;/span&gt;
          &lt;input type="text" name="subject" value="" /&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;span&gt;Attachment:&lt;/span&gt;
          &lt;input type="file" name="pdf" accept="application/pdf" /&gt;                         
      &lt;/div&gt;  
      &lt;input type="submit" value="Send" name="sendForm"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Also If I store my pdf lime temporary file, like this:</p>
  
  <pre><code>$pdf = $_FILES['pdf']['tmp_name'];
  </code></pre>
  
  <p>I dont have any error message when I click in my button to send email, but when I receive the email email have this name: "phpF.tmp", and its impossible to open...</p>