You are here

function imce_validate_tuquota in IMCE 7

Same name and namespace in other branches
  1. 6.2 inc/imce.page.inc \imce_validate_tuquota()

Validate filesize for total user quota.

2 calls to imce_validate_tuquota()
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 715
Implements the file browser.

Code

function imce_validate_tuquota($file, $quota = 0, $currentsize = 0) {
  $errors = array();
  if ($quota && $currentsize + $file->filesize > $quota) {
    $errors[] = t('%filename is %filesize which would exceed your total user 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;
}