You are here

function imce_validate_quota in IMCE 6.2

Same name and namespace in other branches
  1. 6 inc/page.inc \imce_validate_quota()
  2. 7 inc/imce.page.inc \imce_validate_quota()

Validate filesize for directory quota.

2 calls to imce_validate_quota()
imce_validate_all in inc/imce.page.inc
Validate uploaded file.
imce_validate_quotas in inc/imce.page.inc
Validate both directory and total user quota. Returns true/false not errors.

File

inc/imce.page.inc, line 658
Implements the file browser.

Code

function imce_validate_quota($file, $quota = 0, $currentsize = 0) {
  $errors = array();
  if ($quota && $currentsize + $file->filesize > $quota) {
    $errors[] = t('%filename is %filesize which would exceed your directory quota. You are currently using %size of %total_quota.', array(
      '%size' => format_size($currentsize),
      '%total_quota' => format_size($quota),
      '%filesize' => format_size($file->filesize),
      '%filename' => utf8_encode($file->filename),
    ));
  }
  return $errors;
}