file_upload_max_size

Definition

file_upload_max_size()
drupal/includes/file.inc, line 1373

Description

Determine the maximum file upload size by querying the PHP settings.

Return value

A file size limit in bytes based on the PHP upload_max_filesize and post_max_size

Related topics

Namesort iconDescription
File interfaceCommon file handling functions.

Code

function file_upload_max_size() {
  static $max_size = -1;

  if ($max_size < 0) {
    $upload_max = parse_size(ini_get('upload_max_filesize'));
    $post_max = parse_size(ini_get('post_max_size'));
    $max_size = ($upload_max < $post_max) ? $upload_max : $post_max;
  }
  return $max_size;
}