title: Issue uploading multiple files of the same name
body: <p>I have a multiple file upload form in PHP. My issue is when two images of the same name are uploaded the second image is replaced by the earlier one. What can I do? This is my code:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;form action="" enctype="multipart/form-data" method="post"&gt;
  
      &lt;div&gt;
          &lt;label for='upload'&gt;Add Attachments:&lt;/label&gt;
          &lt;input id='upload' name="upload[]" onChange="read_url(this)" type="file" multiple="multiple" id="imgInp" /&gt;
      &lt;/div&gt;
  
      &lt;p&gt;&lt;input type="submit" name="submit" value="Submit"&gt;&lt;/p&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>PHP CODE</strong></p>
  
  <pre><code>if(isset($_POST['submit'])){
      if(count($_FILES['upload']['name']) &gt; 0){
          //Loop through each file
          for($i=0; $i&lt;count($_FILES['upload']['name']); $i++) {
            //Get the temp file path
              $tmpFilePath = $_FILES['upload']['tmp_name'][$i];
  
              //Make sure we have a filepath
              if($tmpFilePath != ""){
  
                  //save the filename
                  $shortname = $_FILES['upload']['name'][$i];
  
                  //save the url and the file
                  $filePath = "store/".$_FILES['upload']['name'][$i];
  
                  //Upload the file into the temp dir
                  if(move_uploaded_file($tmpFilePath, $filePath)) {
  
                      $files[] = $shortname;
  
                      $name = 'Admin';
  
                      $qry="INSERT INTO test(Name,Image) VALUES('$name','$filePath')";
  
                      mysqli_query($link,$qry) or die(mysqli_error($link));
  
  
  
  
                      //use $shortname for the filename
                      //use $filePath for the relative url to the file
  
                  }   
              }
              echo '&lt;p style="color:#000;"&gt;SUCCESS!!&lt;/p&gt;';
  
          }
      }
  </code></pre>
  
  <p>Suggest me....</p>