You are here

function file_space_used in Drupal 6

Same name and namespace in other branches
  1. 7 includes/file.inc \file_space_used()

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 calls to 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.

File

includes/file.inc, line 557
API for handling file uploads and server file management.

Code

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}'));
}