title: CodeIgniter File Upload overwrite FALSE (default) auto-rename issue
body: <p>There is an error message in CodeIgniter </p>
  
  <blockquote>
    <p>The file name you submitted already exists on the server</p>
  </blockquote>
  
  <p>Does that make any sense? Let me explain.</p>
  
  <p>There is a preference in <a href="http://ellislab.com/codeigniter/user-guide/libraries/file_uploading.html" rel="nofollow">File Uploading Class</a> preferences called "overwrite". It can be TRUE or FALSE. The default value is FALSE. If it's TRUE, then the file will be overwritten. If it's FALSE, then a number will be appended to the filename if another with the same name exists. So, either it'll overwrite the file or it will rename the file. How is it possible to get the above error?</p>
  
  <p>So, it looks like CodeIgniter is unable to rename the files properly.</p>
  
  <p>I looked at my database and found how CodeIgniter has renamed the files. Though there are no other file exists with the same name, some of the filenames are appended an underscore ( _ ), but no number after that. I also found that when I tried to upload a file with file name as "myfilename.zip" several times, "myfilename_.zip", "myfilename_1.zip", "myfilename_2.zip" ... "myfilename_11.zip" found at the upload path. But "myfilename.zip" is not found there and instead of creating "myfilename_12.zip", it showed me the above error.</p>
  
  <p>So, where is the issue? How to solve this?</p>
  
  <p><strong>Update:</strong>
  Now I understood why I am getting the error message <code>The file name you submitted already exists on the server</code>. The mechanism to check whether any file with the same name exists work for 100 files. It checks whether any file with the same name exists, if found, then it appends a number to filename and check again. This happens 100 times. If still a file with the same name found, it stops, so that the execution of the script will not take much time. So, we can say there is a limit and 100 is a good limit.</p>
  
  <p>But I am still looking for the answer, why some files are appended an underscore, some with an underscore and then a number, and some with just the number. There is no consistency with the pattern to append a number to the files, if another file with the same name exists.</p>