You are here

function file_upload_max_size in Drupal 6

Same name and namespace in other branches
  1. 8 core/includes/file.inc \file_upload_max_size()
  2. 4 includes/file.inc \file_upload_max_size()
  3. 5 includes/file.inc \file_upload_max_size()
  4. 7 includes/file.inc \file_upload_max_size()

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

4 calls to file_upload_max_size()
blogapi_admin_settings in modules/blogapi/blogapi.module
file_save_upload in includes/file.inc
Saves a file upload to a new location.
upload_admin_settings in modules/upload/upload.admin.inc
Menu callback for the upload settings form.
upload_admin_settings_validate in modules/upload/upload.admin.inc
Form API callback to validate the upload settings form.

File

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

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