by Ezzaral: Added [code] [/code] tags. Please use them to format any code that you post.
Most filenames for uploaded files are pretty meaningless once automatically renamed, but this isn't a problem. Some use a DB to link a 'pretty' false name to a datestamped (renamed!) name. A dynamically-created link for the image could be:
Another idea, before uploading you can check , if the file with same name exists using file_exists() function and if another file found you can rename it using rename().
This way it will be possible what you are trying to do, but this is not the best way to do it.
The best way is stated above, while you uploading the files to server, do that renaming stuff that time only.like whats explained above, appending the current timestamp to the file name and then moving it to server.