REQUEST: file manager quota thing
Moderator: General Moderators
-
rapaddict_dot_com
- Forum Commoner
- Posts: 27
- Joined: Tue Mar 16, 2004 4:54 pm
REQUEST: file manager quota thing
I have a file manager as part of my website for users to upload images for their signatures and audio files for rap battles
the file manager ive made is at http://www.rapaddict.com/users/
I need a snippet to get the total size of the users directory so I can limit the amount of space they have.
Is there some sort of way of cycling through each director in ~user and if its a file add up the size and if its a directory then add all the files inside the directory etc...
thanks, - treez
the file manager ive made is at http://www.rapaddict.com/users/
I need a snippet to get the total size of the users directory so I can limit the amount of space they have.
Is there some sort of way of cycling through each director in ~user and if its a file add up the size and if its a directory then add all the files inside the directory etc...
thanks, - treez
[php_man]opendir[/php_man],[php_man]filesize[/php_man]
Code: Select all
function dir_size($dir){
$size=0;
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if($file=="."||$file=="..") continue;
$size+=dir_size($dir."/".$file);
}
closedir($dh);
}
}
if(is_file($dir))
$size+=filesize($dir);
return $size;
}-
rapaddict_dot_com
- Forum Commoner
- Posts: 27
- Joined: Tue Mar 16, 2004 4:54 pm
thanks!
http://www.rapaddict.com/users/
login: demo
password: demo
tell me what you think... and some suggestions!
Re: thanks!
Insecure.rapaddict_dot_com wrote:tell me what you think... and some suggestions!
-
rapaddict_dot_com
- Forum Commoner
- Posts: 27
- Joined: Tue Mar 16, 2004 4:54 pm
-
rapaddict_dot_com
- Forum Commoner
- Posts: 27
- Joined: Tue Mar 16, 2004 4:54 pm