There is an error message in CodeIgniter
The file name you submitted already exists on the server
Does that make any sense? Let me explain.
There is a preference in File Uploading Class 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?
So, it looks like CodeIgniter is unable to rename the files properly.
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.
So, where is the issue? How to solve this?
Update:
Now I understood why I am getting the error message The file name you submitted already exists on the server
. 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.
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.