Limit dir space

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Clarkent
Forum Newbie
Posts: 6
Joined: Sat Jan 01, 2005 8:29 am

Limit dir space

Post by Clarkent »

It's possible by PHP code to limit size of a directory on server ? E.g. My dir /home/umbumbym/public_html/mark (only /mark of course) must contain max 5 Mbyte ...
Can I insert a little script that verify the dir content (files and subdir) and calculate the byte amount and allows or not other uploads ...
It is possible ?


Thanks

Sorry for my english
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

yes, you can use the [php_man]opendir()[/php_man] or [php_man]glob()[/php_man] (newer php required) to obtain a file list and iterate through them getting sizes of each.
Post Reply