function Environment::getUploadMaxSize
Same name in other branches
- 9 core/lib/Drupal/Component/Utility/Environment.php \Drupal\Component\Utility\Environment::getUploadMaxSize()
- 8.9.x core/lib/Drupal/Component/Utility/Environment.php \Drupal\Component\Utility\Environment::getUploadMaxSize()
- 11.x core/lib/Drupal/Component/Utility/Environment.php \Drupal\Component\Utility\Environment::getUploadMaxSize()
Determines the maximum file upload size by querying the PHP settings.
Return value
int A file size limit in bytes based on the PHP upload_max_filesize and post_max_size settings.
9 calls to Environment::getUploadMaxSize()
- CKEditor5ImageController::getImageUploadValidators in core/
modules/ ckeditor5/ src/ Controller/ CKEditor5ImageController.php - Gets the image upload validators.
- EditorImageDialog::buildForm in core/
modules/ editor/ src/ Form/ EditorImageDialog.php - editor_image_upload_settings_form in core/
modules/ editor/ editor.admin.inc - Subform constructor to configure the text editor's image upload settings.
- FileItem::fieldSettingsForm in core/
modules/ file/ src/ Plugin/ Field/ FieldType/ FileItem.php - FileValidatorSettingsTrait::getFileUploadValidators in core/
modules/ file/ src/ Validation/ FileValidatorSettingsTrait.php - Gets the upload validators for the specified settings.
File
-
core/
lib/ Drupal/ Component/ Utility/ Environment.php, line 83
Class
- Environment
- Provides PHP environment helper methods.
Namespace
Drupal\Component\UtilityCode
public static function getUploadMaxSize() {
static $max_size = -1;
if ($max_size < 0) {
// Start with post_max_size.
$max_size = Bytes::toNumber(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 = Bytes::toNumber(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.