Jump to content

multiple instances access same directory


ala888

Recommended Posts

Im making a webserver that for every file received,

finds a randomly generated folder name, checks if it already exists; and if it does not,

it puts the files in there.But what if multiple instances are running at the same time, and by the luck of the draw, more than one batch of files gets dumped

into the same folder since all the php instances though it didnt exist at the exact same time?Is there any way to prevent this?

Link to comment
Share on other sites

To clarify my question, I am first checking if a file directory exists via file_exists in php, before creating and inserting uploaded files

into it. However, since the server is a multithreaded one, I am afraid that two instances of the script might somehow check the same file name at the same type, before

running into each other.

Edited by ala888
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...