Skip to main content

By default the maximum file upload size is set to 2MB.  It is not a Drupal issue, instead a php issue as upload_max_filesize is set in your php configuration (php.ini file).  Therefore it is a server-side configuration. If you have access to the php configuration file, I would recommend to make the changes directly in it.  Yet, on some occasions you cannot access the server configuration (on a shared hosting, for instance) and if you wish to alter some of your server configuration you have to use the .htaccess file (see more info here)


Looking at ways to solve

1. Make the changes directly into php.ini (find upload_max_filesize and change its value).

2. use the .htaccess if you don't have access to the php.ini file. (The upload module does not make anything else than altering the .htaccess file).


How to investigate this error

Global response

How to find the php.ini in use?  In shell run the command:

php -i

This will output the phpinfo() data... displaying something like

PHP Version => 7.4.19

System => Linux ip-10-0-2-168.ap-southeast-2.compute.internal 4.14.232-176.381.amzn2.x86_64 #1 SMP Wed May 19 00:31:54 UTC 2021 x86_64

Build Date => May 13 2021 22:36:33

Server API => Command Line Interface

Virtual Directory Support => disabled

Configuration File (php.ini) Path => /etc

Loaded Configuration File => /etc/php.ini

Scan this dir for additional .ini files => /etc/php.d


Do a search for php.ini to see the result being something like:

Configuration File (php.ini) Path => /etc


Configuration File (php.ini) Path => /etc

Loaded Configuration File => /etc/php.ini


Using --ini

Another approach is to run the command

php --ini

That will provide a response similar to

Configuration File (php.ini) Path: /opt/plesk/php/8.2/etc
Loaded Configuration File:         /var/www/vhosts/{domain}/etc/php.ini
Scan for additional .ini files in: /opt/plesk/php/8.2/etc/php.d
Additional .ini files parsed:


Using grep

php -i | grep php.ini


Configuration File (php.ini) Path => /opt/plesk/php/8.2/etc
Loaded Configuration File => /var/www/vhosts/{domain}/etc/php.ini



Resolving the error

Now that you know the php.ini file being used (for me it was /etc), you can edit the php.ini file through using the vi command either going to the directory path and using:

vi php.ini


vi /etc/php.ini

While in edit mode, perform a quick search rather than scrolling through the file using /{search term}.  In this instance search for upload_max_filesize, subsequently the find entry will be


The search command will take you to the following area:

; File Uploads ;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

Change the upload_max_filesize from 2M to your required size.

; Maximum allowed size for uploaded files.
upload_max_filesize = 10M


You will also need to check the post_max_size.  Use the same process as above to locate and change this setting.


The search command will take you to the following area:

; Whether PHP will read the POST data.
; This option is enabled by default.
; Most likely, you won't want to disable this option globally. It causes $_POST
; and $_FILES to always be empty; the only way you will be able to read the
; POST data will be through the php://input stream wrapper. This can be useful
; to proxy requests or to process the POST data in a memory efficient fashion.
;enable_post_data_reading = Off

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
post_max_size = 8M

; Automatically add files before PHP document.
auto_prepend_file =

Change the post max size to the same as the upload_max_filesize noted above

post_max_size = 10M


Save and close vim, press [Esc] key and type :wq!



Once you have completed the above steps, restart your server for the changes to apply.  Go to to check if the changes were applied.

Related articles

Andrew Fletcher22 Nov 2023
Fatal error: Maximum execution time of 30 seconds exceeded in ...
When reloading a page, you may encounter the following error:Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/content/core/lib/Drupal/Core/{some file .php} on line n SolutionTo resolve this issue, you need to adjust the max_execution_time parameter in the php.ini...
Andrew Fletcher16 Nov 2023
Drupal and AWS - over 300 simultaneous database connections
The issue of over 300 simultaneous database connections in the context of AWS and Drupal can have several potential causes. Here are some common factors to consider:Server ConfigurationCheck your server configuration to ensure it can handle the expected number of simultaneous connections. This...