File uploading

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
rahiparikh
Forum Newbie
Posts: 1
Joined: Fri Sep 18, 2009 2:20 pm

File uploading

Post 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!
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Re: File uploading

Post 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.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Re: File uploading

Post 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.
Post Reply