51ff3226 |
1 | <?php |
2 | class filez { |
3 | |
4 | function filez($id) { |
5 | global $db,$error; |
6 | if (!is_dir(FILE_DIR.$_SESSION['user_id'])) { |
7 | mkdir(FILE_DIR.$_SESSION['user_id']); |
8 | } |
9 | copy($_FILES['data_file']['tmp_name'],FILE_DIR.$_SESSION['user_id'].'/'.$_FILES['data_file']['name']); |
10 | return $_SESSION['user_id'].'/'.$_FILES['data_file']['name']; |
11 | } |
12 | |
13 | } |
14 | |
15 | /* |
16 | * Returns disk usage in bytes of directory $d. Limit depth level with $depth. |
17 | * Updates, documentation and examples: http://daniel.lorch.cc/projects/disk_usage/ |
18 | * |
19 | * Revision: 1.00 |
20 | */ |
21 | |
22 | function disk_usage($d, $depth = NULL) { |
23 | if(is_file($d)) |
24 | return filesize($d); |
25 | |
26 | if(isset($depth) && $depth < 0) |
27 | return 0; |
28 | |
29 | if($d[strlen($d)-1] != '\\' || $d[strlen($d)-1] != '/') |
30 | $d .= '/'; |
31 | |
32 | $dh=@opendir($d); |
33 | if(!$dh) |
34 | return 0; |
35 | |
36 | while($e = readdir($dh)) |
37 | if($e != '.' && $e != '..') |
38 | $usage += disk_usage($d.$e, isset($depth) ? $depth - 1 : NULL); |
39 | |
40 | closedir($dh); |
41 | |
42 | return $usage; |
43 | } |
44 | |
45 | |
46 | ?> |