
October 19th, 2003
08:00 PM
Limiting foldersize?
I am in the process of creating almost like a webhositng manager script for my friend. I was wodnering is there any way to limit the size of a FOLDER not file but folder in general. So lets say they have a 2mb file and a 26mb file and the limit was 30mb they could only up a 2mb or less file or it would come up with an error.
I know that this is possible by doing it manualy in apache but is there any way to automate it with like php or perl?

October 19th, 2003
08:05 PM
Neverside Newbie
Status: Offline!
Calculate how much 'free' space there is in the directory before the upload. Then when the user attempts to upload a file, check if its larger than the 'free' space and if it is give an error message and don't move it to the directory from your temp directory.
___________________
RAAAH

October 19th, 2003
08:06 PM
with Mr. Jones
Status: Offline!
You'd have to find the size of the folder and restrict uploading if its too much. The only way to find size of a folder is by recursively finding the size of all files inside it.
___________________
http://www.philbrodeur.com - Expert PHP Development and Tutorials

October 19th, 2003
08:11 PM
Neverside Newbie
Status: Offline!
Yep, read a directory, loop through all the files, add the file sizes. When you get that and he tries to upload another file, add that to the filesize that you just made (by looping through) and if it's over the limit, don't upload / save it to disk, just redirect or something.
___________________
Travis Farrell


October 19th, 2003
09:21 PM
ok thanks how do i find the size of a file?