Why file name and uri of the file in database are different? I am uploading the files to the folder by using file_save_upload and file_move to achieve this. Its working fine but a problem arises while saving in database.  I have used FILE_EXISTS_RENAME argument, so in file_managed table filename column and uri column file name is not same. In filename column its not appending the integer value, but in uri column its appending the integer value since the file is already exist. Below is my code:

  for ($i = 0; $i &lt; $num_files; $i++) {
      $file = file_save_upload($i, $validators, FILE_EXISTS_RENAME);   
      if ($file) { 
        $file-&gt;status = FILE_STATUS_PERMANENT;
        if ($file = file_move($file, 'public://feed-files/' . $foldername, FILE_EXISTS_RENAME)) { 
          $form_state['values']['file'][$i] = $file;
        }
        else {
          form_set_error('file', t('Failed to write the uploaded file to the selected folder.'));
          return FALSE;
        }
      }
      else {
        form_set_error('file', t('No file was uploaded.'));
        return FALSE;
      }
    }


below is the database values:



So how can achieve that filename and uri  column file name should be same. Any suggestions will be appreciated.
The reason for difference is that multiple files with same name can be uploaded in Drupal, so when you upload a file, it adds a counter at the end of filename so that if a file with same name is uploaded again, then it doesn't replace another one.

Also the filename column contains the exact name of the uploaded file as it is used while downloading the file (the file will be downloaded with this name).