Upload file name in database with rename in PHP : <p>I am trying to insert file name in database in php. And file will move to CV folder. I used a function to reneme that file.It does not work .</p>

<pre><code>&lt;form method="POST" enctype="multipart/form-data"&gt;
    &lt;input type="file" name="file" required&gt;
    &lt;input type="submit" name="job_post" value="Submit"&gt;
&lt;/form&gt;
</code></pre>

<p><strong>PHP</strong></p>

<pre><code>if($_SERVER["REQUEST_METHOD"] == "POST"){
    function getFileName($file)
    {
      return date('mdhms'). '.' . $file-&gt;extension();
    }
  $f_name= $_POST['file'];
  $filename = getFileName($f_name);
  move(base_path('cv'), $filename); 
  $job_post_sql="INSERT INTO applications (cv,flag) VALUES ('$filename','1')";
  $job_post_sql_result=mysqli_query($con,$job_post_sql);
}
</code></pre>
