title: How to change image file name before uploading to database in php
body: <p>How to rename the file of image before inserting into database?</p>
  
  <ul>
  <li>DB name :Project</li>
  <li>Table Name: image</li>
  <li>ields: id (<code>int</code>), file (<code>varchar</code>) [image url stored here], name (<code>varchar</code>) [image description]</li>
  </ul>
  
  <p>HTML Codes GOES HERE</p>
  
  <pre><code>&lt;form method="POST" action="signup_process.php" enctype="multipart/form-data"&gt;
   Image:  &lt;input type="file" name="user_image"&gt;
  &lt;input tyoe="submit" value="submit"&gt;
   &lt;/form&gt;
  </code></pre>
  
  <p>signup_process.php</p>
  
  <pre><code> &lt;?php
      include 'dbcon.php';
      $filename = $_FILES[user_image][name];
      $source = $_FILES[customer_photo][tmp_name];
      $destination = "photos/$filename";
      move_uploaded_file($source, $destination);
  
  //sql statement bla bla below to upload file in image table
  
      ?&gt;
  </code></pre>
  
  <p>This script upload the file in photos directory of my seerver but what i want is i want to change that name to corresponding id of my image table .
  <strong>for example sunshine.jpg  --> 5.jpg</strong> </p>