file_space_used

includes/file.inc, line 445

Versions
6
file_space_used($uid = NULL)
7
file_space_used($uid = NULL, $status = FILE_STATUS_PERMANENT)

Determine total disk space used by a single user or the whole filesystem.

Parameters

$uid An optional user id. A NULL value returns the total space used by all files.

Related topics

▾ 2 functions call file_space_used()

file_validate_size in includes/file.inc
Check that the file's size is below certain limits. This check is not enforced for the user #1.
upload_space_used in modules/upload/upload.module
Determine how much disk space is occupied by a user's uploaded files.

Code

<?php
function file_space_used($uid = NULL) {
  if (isset($uid)) {
    return (int) db_result(db_query('SELECT SUM(filesize) FROM {files} WHERE uid = %d', $uid));
  }
  return (int) db_result(db_query('SELECT SUM(filesize) FROM {files}'));
}
?>
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.