Skip to content

Understanding PHP upload_max_filesize

The upload_max_filesize directive in PHP determines the maximum size of an uploaded file. This setting helps you control the size of files users can upload to your server. By default, this value is set to 2MB, but you can change it to suit your needs.

To change the upload_max_filesize value, follow these steps:

  1. Locate the php.ini File: This file is usually found in the PHP installation directory.
  2. Edit the php.ini File: Open the file in a text editor and search for upload_max_filesize.
  3. Update the Value: Set the desired maximum file size. For example, upload_max_filesize = 64M sets the limit to 64MB.
  4. Restart the Web Server: After making changes, restart the web server to apply the new settings.

Besides upload_max_filesize, you should consider other related directives for optimal configuration:

  • post_max_size: This directive sets the maximum size of POST data that PHP will accept. It should be larger than upload_max_filesize.
  • memory_limit: Ensure this value is larger than post_max_size to handle the uploaded data efficiently.
; Example settings
upload_max_filesize = 64M
post_max_size = 72M
memory_limit = 128M

WordPress has its memory settings, which can impact file uploads:

  • WP_MEMORY_LIMIT: This defines the default memory limit for WordPress. You can set it in the wp-config.php file.
  • WP_MAX_MEMORY_LIMIT: This setting is used for increasing memory for administrative tasks.

The max_execution_time directive determines how long a script is allowed to run. If you are uploading large files, you may need to increase this value. This ensures the upload process doesn’t time out.


Configuring upload_max_filesize and related directives ensures smooth file uploads. Remember to align PHP settings with WordPress configurations to avoid issues. By understanding and adjusting these parameters, you can manage file uploads more effectively.

The Site health screen shows the setting under Details, as Max upload size in the Server panel. When it is below 32 MB, the Reliability area shows the warning Uploads are limited to 8 MB (with your value): larger media files cannot be uploaded. A value of -1 (no limit) never counts as too low.