Page 1 of 1

File uploading

Posted: Fri Sep 18, 2009 2:32 pm
by rahiparikh
Hi, I have just started to learn php for web programming. I am willing to make a web application and part of that consists of uploading of files from client to server. Now I thought of creating a hierarchy of file system. What I wish to do is something like this.

Create a folder named xxx1 and put 'a' number of files in it. When that number 'a' is reached I wish to create a new folder xxx2 and then put 'a' numbers of files again. And same way I wish to continue with it.

I am worried about parallel requests coming from the client. So what are the issues and mainly security issues that I should be concerned with?

You may feel my question to be too naive but if you could help me learn and know things, it will be your great help.

Thanks!

Re: File uploading

Posted: Sat Sep 19, 2009 2:10 am
by kaisellgren
If you need to be precise, you could create a counter in a database, provide an upload form and after an upload has completed, check the database counter value, and if it is smaller than a specific number, then lock the table, update it and move the uploaded file to the folder and release the lock.

Re: File uploading

Posted: Sat Sep 19, 2009 3:01 am
by Burrito
or you could simply count the files in the folder, if the threshold has been met, create a new folder and dump the uploaded file(s) in the new folder and continue this method over and over.