You are here

function imce_validate_filesize in IMCE 7

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

Validate filesize for maximum allowed file size.

1 call to imce_validate_filesize()
imce_validate_all in inc/imce.page.inc
Validate uploaded file.

File

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

Code

function imce_validate_filesize($file, $maxsize = 0) {
  $errors = array();
  if ($maxsize && $file->filesize > $maxsize) {
    $errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array(
      '%filesize' => format_size($file->filesize),
      '%maxsize' => format_size($maxsize),
    ));
  }
  return $errors;
}