I have developed an API integration, It contains multiple image/file uploads. There are name conflicts if multiple users uploads file with the same name.
I’ve planned to create dynamic folders with random names to fix this issue (as temp folder & will delete once the process has been done). Are there any methods/techniques available to generate random folders in PHP?
For things like this, I’ve found the php function uniqid to be useful.
Basically, something like this:
And then just move the uploaded file to this directory.
Edit: Forgot to mention, the directory name is not random, but is guaranteed to be unique, which seems to be what you need.