title: how to insert file name into mysql database
body: <p>I'm trying to figure out from a long time to print my file name in the MySQL database, file is uploading successfully into the path folder but unable to insert the file name into the database. below is my code</p>
  
  <pre><code>Choose file: &lt;span class="text-danger"&gt;Max size 1mb, doc, pdf, jpg, jpeg, png &amp; gif only&lt;/span&gt;
              &lt;input type="file" name="fileToUpload" id="fileToUpload" required&gt; 
              &lt;input type="hidden" value="Upload Image" name="submit"&gt;
  
       &lt;?php
   $target_dir = "../online/upload_files/";
   $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
   $uploadOk = 1;
  $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
  
  // Check if file already exists
  if (file_exists($target_file)) {
      echo '&lt;span style="color:#C0392B;text-align:center; size:45"&gt; Sorry, 
   file already exists.&lt;/span&gt;';
    $uploadOk = 0;
  }
  
   // Check file size
   if ($_FILES["fileToUpload"]["size"] &gt; 1048576) {
  echo "Sorry, your file is too large.";
  $uploadOk = 0;
   }
  
  // Allow certain file formats
  if($imageFileType != "jpg" &amp;&amp; $imageFileType != "png" &amp;&amp; $imageFileType != 
  "jpeg"
   &amp;&amp; $imageFileType != "gif" &amp;&amp; $imageFileType != "doc" &amp;&amp; $imageFileType != 
  "docx" 
  &amp;&amp; $imageFileType != "pdf"&amp;&amp; $imageFileType != "xlsx") {
     echo  '&lt;span style="color:#C0392B;text-align:center;"&gt;Sorry, only JPG, 
   JPEG, PNG, doc, pdf &amp; GIF  files are allowed.&lt;/span&gt;' ;
      $uploadOk = 0;
   }
  
   // Check if $uploadOk is set to 0 by an error
   if ($uploadOk == 0) {
       echo '&lt;span style="color:#C0392B;text-align:center;"&gt;Sorry, your file 
   was not uploaded.&lt;/span&gt;';
  
   // if everything is ok, try to upload file
    } else {
       if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], 
   $target_file)) {
           echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has 
   been uploaded. &amp; &lt;b&gt;Proposal Submited Successfully.&lt;/b&gt;";
       } else {
           echo '&lt;span style="color:#C0392B;text-align:center;"&gt; Sorry, there 
   was an error uploading your file.&lt;/span&gt;';
       }
   }
  
   ?&gt;
  </code></pre>