File Upload to Server with Different Name


I made a mobile game. Every user will upload 1.xml file to my server from their game. I wanna keep all these 1.xml files. But because of being xml files' names are the same(1.xml), I can't keep all of them. Like this there is only one file on server(1.xml). How can I keep all of them? is there any opinion?

I agree with FD_ in that you might want to rethink how you are saving that data.

If you definitely need to store the xml file though you could have your game call a php file (i.e. which will look at the last number of the uploaded file and increment it by one. So for the first user to upload a file the script would return 1 and you would upload the xml file as 1.xml. The second user would hit that php script and it would return 2 (since it scans the upload directory and knows what the highest number uploaded was) and so that user would upload as 2.xml.

Does that make sense?

EDIT: Or you could just name the file a random string of numbers + the datestamp. There is a chance you might overwrite an existing file, but it's small