function file_upload_max_size
Same name in other branches
- 8.9.x core/includes/file.inc \file_upload_max_size()
Determines 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()
- file_ajax_upload in modules/
file/ file.module - Menu callback; Shared Ajax callback for file uploads and deletions.
- file_field_instance_settings_form in modules/
file/ file.field.inc - Implements hook_field_instance_settings_form().
- file_field_widget_upload_validators in modules/
file/ file.field.inc - Retrieves the upload validators for a file field.
- file_save_upload in includes/
file.inc - Saves a file upload to a new location.
File
-
includes/
file.inc, line 2267
Code
function file_upload_max_size() {
static $max_size = -1;
if ($max_size < 0) {
// Start with post_max_size.
$max_size = parse_size(ini_get('post_max_size'));
// If upload_max_size is less, then reduce. Except if upload_max_size is
// zero, which indicates no limit.
$upload_max = parse_size(ini_get('upload_max_filesize'));
if ($upload_max > 0 && $upload_max < $max_size) {
$max_size = $upload_max;
}
}
return $max_size;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.