title: Upload PDF File to mysql database using php
body: <p>Hi how can I get my PDF file uploaded to mysql database, My situation now is that all of my others data can be save into the database successfully but the PDF file cannot be uploaded.</p>
  <p>PHP</p>
  <pre><code>if (isset($_POST['add'])) {
      $name = $_POST['name'];
      $position = $_POST['position'];
      $mobileno = $_POST['mobileno'];
      $email = $_POST['email'];
      $dateAva = $_POST['dateAva'];
      $course = $_POST['course'];
  
      $filename = $_FILES[&quot;resume1&quot;][&quot;name&quot;];
      $tempname = $_FILES[&quot;resume1&quot;][&quot;tmp_name&quot;];
      $folder = &quot;pdf/&quot; . $filename;
  
      $sql = &quot;INSERT INTO jobApplication (name,position,phone,email,dateAva,course,resume)
                  VALUES ('$name','$position','$mobileno','$email','$dateAva','$course','$filename')&quot;;
      $query = $dbh-&gt;prepare($sql);
      $query-&gt;execute();
  
      if (move_uploaded_file($tempname, $folder)) {
          $msg = &quot;Image uploaded successfully&quot;;
      } else {
          $msg = &quot;Failed to upload image&quot;;
      }
  }
  </code></pre>
  <p>HTML</p>
  <pre><code>&lt;form method=&quot;POST&quot; action=&quot;&quot; enctype=&quot;multipart/form-data&quot;&gt;
    &lt;table style=&quot;margin-top:25px;margin-bottom:25px;&quot;&gt;
      &lt;tr class=&quot;tableTitle&quot;&gt;
        &lt;th colspan=&quot;2&quot;&gt;&lt;center&gt;Upload Resume&lt;/th&gt;
      &lt;/tr&gt;
      &lt;td&gt;
        &lt;input style=&quot;margin-left:600px;&quot; class=&quot;tableBody&quot; type=&quot;file&quot; id=&quot;resume1&quot; name=&quot;resume1&quot;&gt;
      &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  
    &lt;div class=&quot;input-field col s12&quot;&gt;
      &lt;button type=&quot;submit&quot; name=&quot;add&quot; onclick=&quot;return valid();&quot; id=&quot;add&quot; class=&quot;waves-effect waves-light btn indigo m-b-xs&quot;&gt;ADD&lt;/button&gt;
    &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>