You are here

function file_upload_max_size in Drupal 8

Same name and namespace in other branches
  1. 4 includes/file.inc \file_upload_max_size()
  2. 5 includes/file.inc \file_upload_max_size()
  3. 6 includes/file.inc \file_upload_max_size()
  4. 7 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

Deprecated

in drupal:8.7.0 and is removed from drupal:9.0.0. Use \Drupal\Component\Utility\Environment::getUploadMaxSize() instead.

Related topics

1 call to file_upload_max_size()
FileSystemDeprecationTest::testDeprecatedFileUploadMaxSize in core/tests/Drupal/KernelTests/Core/File/FileSystemDeprecationTest.php
@expectedDeprecation file_upload_max_size() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal\Component\Utility\Environment::getUploadMaxSize() instead. See https://www.drupal.org/node/3000058.

File

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

Code

function file_upload_max_size() {
  @trigger_error('file_upload_max_size() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \\Drupal\\Component\\Utility\\Environment::getUploadMaxSize() instead. See https://www.drupal.org/node/3000058.', E_USER_DEPRECATED);
  return Environment::getUploadMaxSize();
}