title: How to store image file in phpmyadmin?
body: <p>I have created a form and wanted to store all the information in PHPMyAdmin. I managed to store the other information but not the image file. It has nothing under the image column in PHPMyAdmin even though it states submitted when I submit the form.</p>
  
  <p>form2.php</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;/head&gt;
  &lt;h1&gt;Found Items Handover&lt;/h1&gt;
  
      &lt;br&gt;
  
      &lt;div class="container"&gt;
          &lt;div class="row"&gt;
              &lt;h2&gt;1. Details of Handover Personnel &lt;/h2&gt;
          &lt;/div&gt;
  
  
  &lt;form action="insert2.php" method="post" enctype="multipart/form-data"&gt;
   &lt;div class="row input-container"&gt;
              &lt;div class="col-md-6 col-sm-12"&gt;
                  &lt;div class="styled-input"&gt;
                      &lt;input type="text" name="name"required /&gt;
                      &lt;label&gt;Staff Name&lt;/label&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="col-md-6 col-sm-12"&gt;
                  &lt;div class="styled-input" style="float:right;"&gt;
                      &lt;input type="text" name="staffno" required /&gt;
                      &lt;label&gt;Staff Number&lt;/label&gt;
                  &lt;/div&gt;
              &lt;/div&gt; &lt;br&gt;
                  &lt;div&gt;
                    &lt;label&gt;Attachment:&lt;/label&gt;&lt;input type='file' name='file'&gt;&lt;br&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
  
  &lt;br&gt;&lt;input type="submit" name="submit" value="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>inser2.php</p>
  
  <pre><code>&lt;?php
  
      $con= mysqli_connect('127.0.0.1','root','','satsform1');
  
      if(!$con)
      {
          echo 'Not Connected To Server';
      }
  
      if(!mysqli_select_db($con,'satsform1'))
      {
          echo 'Database Not Selected';
      }
  
      $name = $_POST['name'];
      $staffno = $_POST['staffno'];
  
  
  
  
  
  
  
      $sql = "INSERT INTO handover (name,staffno) 
      VALUES ('$name','$staffno')";
  
      if(isset($_POST['submit'])){
  
    $name = $_FILES['file']['name'];
    $target_dir = "upload/";
    $target_file = $target_dir . basename($_FILES["file"]["name"]);
  
    // Select file type
    $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
  
    // Valid file extensions
    $extensions_arr = array("jpg","jpeg","png","gif");
  
    // Check extension
    if( in_array($imageFileType,$extensions_arr) ){
  
       // Insert record
       $query = "insert into images(name) values('".$name."')";
       mysqli_query($con,$query);
  
       // Upload file
       move_uploaded_file($_FILES['file']['tmp_name'],$target_dir.$name);
  
    }
  
  }
  
      if(!mysqli_query($con,$sql))
      {
          echo 'Not Submitted';
      }
      else
      {
          echo 'Submitted';
      }
  
  
  ?&gt;
  </code></pre>
  
  <p>I expect the URL of the image to be stored in PHPMyAdmin when I submit the form.</p>