trained_monkey;10927860 wrote:The users upload images anonymously, there's no log in process. I want to design a script that will create a folder where the images go. The folder will have to have a unique name for each user uploading the images.
That sounds like a contradiction to me. 🙂 But I'm just giving you a hard time. You explain below...
trained_monkey;10927860 wrote: I think the simplest way to do this is to append a number to a generic folder name (as in 'user1', 'user2', 'user3'...). The script scans for the largest number and increases it by one then uses it to name the next folder.
Are these throwaway folders? I mean why worry about it if the users are anonymous? Unless you need a way to temporarily link the current user to their upload folder in a SESSION???
Do you implement sessions in any way? Why not make a folder with the session id of the current user? If that guid named folder is too ugly for you, you can simply prefix "user" and then create a shorter prettier random number (there are many code examples of creating random strings or numbers. See rand() ) Then just store the new folder name in the user's session.
trained_monkey;10927860 wrote: Is there going to be a problem with this system when there're multiple users accessing the script at the same time?
If you make a random number as I suggested it shouldn't be an issue. To be more certain, you can use file_exists() to check before you create the new folder.