Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared Managed Cloud India
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Best lists Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Troubleshooting · Guide

How to Increase the Maximum Upload Size in WordPress

Short answer

Raise upload_max_filesize and post_max_size in your host PHP settings, php.ini, or .user.ini, keeping post_max_size larger than upload_max_filesize. Set memory_limit to 256M and max_execution_time to 300 seconds. On Multisite, also raise Max upload file size in Network Admin > Settings.

Key takeaways

  • WordPress shows the smaller of upload_max_filesize and post_max_size, so raise both.
  • PHP ships with upload_max_filesize at 2M and post_max_size at 8M.
  • Keep post_max_size larger than upload_max_filesize, and memory_limit larger than post_max_size.
  • On Multisite, Max upload file size defaults to 1500 KB and caps uploads until you raise it.
  • A wp-config.php line will not raise the upload limit; use php.ini, .user.ini, or your host panel.

What sets the maximum upload size in WordPress?

Two PHP settings set it: upload_max_filesize caps one file, and post_max_size caps the whole request, and WordPress shows the smaller of the two.

WordPress has no upload limit of its own on a single site. It reads those two PHP values and shows the smaller one on the upload screen. The PHP manual states that post_max_size must be larger than upload_max_filesize when you upload large files.

PHP ships with upload_max_filesize at 2M and post_max_size at 8M. Those defaults are listed in the PHP manual and in the PHP runtime page, and they explain why many fresh installs show “Maximum upload file size: 2 MB”.

If you raise only upload_max_filesize to 64M and leave post_max_size at 8M, the screen still shows 8 MB. The smallest value always wins, so you must raise both.

What do you need before you start?

You need a backup, your current limit, and a target size based on the largest file you will upload.

Back up files and the database before you edit any server file. A wrong line in .htaccess or php.ini can stop the whole site, so a backup you can restore is the first step.

Find your current limit in two places. Go to Media > Add New and read the line under the upload area. Then go to Tools > Site Health > Info, open Media Handling, and read “Max size of an uploaded file”, “Max size of post data allowed”, and “Max effective file size”.

Pick a target size from the file you need to upload. A large photo may need 32 MB, a video may need 128 MB, and a theme zip may need 64 MB. Set the limit a little above the file size, not far above it.

  • A current backup of files and the database
  • Your current limit from Media > Add New and Site Health
  • The size of the largest file you plan to upload
  • File access through your host panel, SFTP, or SSH
  • 15 to 30 minutes, plus time to upload a file

How do you raise the limit in your host PHP settings?

Open the PHP settings screen in your host panel, set upload_max_filesize and post_max_size, then check the upload screen.

This is the easiest method on most shared hosts. In cPanel, the screen is called MultiPHP INI Editor or Select PHP Version. Other panels call it PHP Settings or PHP Configuration.

Follow these steps:

  1. Open your host control panel and find the PHP settings screen.
  2. Select your domain.
  3. Set upload_max_filesize to your target, such as 64M.
  4. Set post_max_size to a larger value, such as 80M or 96M.
  5. Save the change.
  6. Go to Media > Add New and check that the limit now shows the new value.

The PHP manual states that memory_limit should be larger than post_max_size in most cases. If you set post_max_size to 96M, keep memory_limit at 128M or higher. PHP lists the default memory_limit as 128M in the same manual.

If your host panel has no PHP settings screen, use the php.ini or .user.ini method below. Ask support for the right file if you are not sure which one your host reads.

How do you raise the limit in php.ini or .user.ini?

Add the same three lines to php.ini or .user.ini in your site root, then check Site Health.

Use php.ini when you control the server. Use .user.ini on most shared hosts that run PHP-FPM or FastCGI, because PHP reads that file per folder. Add these lines, with your own target values:

upload_max_filesize = 64M
post_max_size = 96M
memory_limit = 256M

Save the file. PHP-FPM reads .user.ini again after a short delay, often within 5 minutes. A php.ini change may need a PHP restart, which your host can do for you.

Check the result in Tools > Site Health > Info > Media Handling. The “Max effective file size” row should show the new value.

If it still shows the old value, you edited a file your site does not read. Ask your host for the path to the file it does read.

Do not use wp-config.php for this change. The PHP manual lists upload_max_filesize as a per-directory setting, not one you can change with ini_set() in a WordPress file. A line in wp-config.php will not raise the upload limit.

How do you raise the limit in .htaccess?

Add php_value lines to .htaccess, but use this method only on Apache with mod_php or a matching LiteSpeed setup.

On many modern hosts, PHP runs as PHP-FPM, and a php_value line in .htaccess causes a 500 error. Check the PHP SAPI value in Tools > Site Health > Info > Server first. If it says fpm-fcgi, use the .user.ini method instead.

Follow these steps:

  1. Open your host file manager and show hidden files, so .htaccess is visible.
  2. Download a copy of .htaccess before you edit it.
  3. Open .htaccess and add these lines outside the WordPress rewrite block:
php_value upload_max_filesize 64M
php_value post_max_size 96M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300
  1. Save the file and load your site.

If the site shows a 500 error at once, remove the lines you added and restore your backup copy. That result means your host does not support PHP settings in .htaccess. Use the .user.ini method instead.

The max_execution_time value of 300 seconds gives a large file time to upload and process. The PHP manual sets the default for that setting to 30 seconds, so 300 is 10 times the default.

What are the limits for each setting?

The table below lists the four settings that matter, their PHP defaults, and a starting value for a site that uploads large media.

SettingPHP defaultStart valueWhat it caps
upload_max_filesize2M64MOne uploaded file
post_max_size8M96MWhole POST request
memory_limit128M256MMemory for one script
max_execution_time30 seconds300 secondsTime for one script
max_input_time-1300 secondsTime to read request data

The defaults for upload_max_filesize and post_max_size come from the PHP manual. The memory_limit default of 128M comes from the same page.

The max_execution_time default of 30 seconds comes from the PHP runtime page, which also states that max_input_time defaults to -1, which means max_execution_time is used instead.

Keep post_max_size larger than upload_max_filesize by at least 16M. The request holds the file plus form fields and upload headers, so it needs room above the file size. A 64M file with a 64M post limit can still fail.

Keep memory_limit larger than post_max_size. The PHP manual states that rule in plain terms, and a 256M memory limit covers a 96M post size with room to spare.

What about Multisite, Nginx, and other caps?

Multisite adds its own cap, Nginx adds another, and the smallest cap on the path always wins.

On Multisite, go to Network Admin > Settings and find Upload Settings. The field “Max upload file size” defaults to 1500 KB, as shown on the Network Admin Settings page. That is about 1.5 MB, so it caps every upload until you raise it.

Enter the value in kilobytes. For 64 MB, enter 65536. For 128 MB, enter 131072.

Raising this field above the PHP limit changes nothing, and raising PHP above this field changes nothing either. Both must be above the file size.

Nginx adds a separate cap called client_max_body_size, which defaults to 1 MB on many servers. If your site runs on Nginx, ask your host to raise that value too, or the server will refuse the file before PHP sees it. You cannot change it from WordPress.

If your site sits behind a proxy or a CDN, that service may add its own cap as well. Ask your host which caps apply to your site, and raise them in order from the front of the path to the back.

How do you check the new limit worked?

Upload a file close to the new limit, then confirm the number on the upload screen and in Site Health.

First, go to Media > Add New and read the upload limit under the upload area. It should show your new value, such as 64 MB. If it shows the old value, your change did not apply.

Second, go to Tools > Site Health > Info > Media Handling and read “Max effective file size”. That value is the smaller of the two PHP settings, so it should match the upload screen.

Third, upload a file that is larger than the old limit but smaller than the new one. If it uploads and appears in the Media Library, the change worked. If it fails with "The uploaded file exceeds the upload_max_filesize directive in php.ini", the PHP setting did not change.

If the upload fails with “The link you followed has expired”, the file may have passed upload_max_filesize but hit post_max_size. Raise post_max_size further and check again. The guide on the upload size error covers that message in more detail.

What mistakes should you avoid?

Do not raise only one setting, do not use wp-config.php for this change, and do not set the limit far above what you need.

The most common mistake is raising upload_max_filesize to 64M and leaving post_max_size at 8M. The screen still shows 8 MB, because WordPress shows the smaller of the two. Raise both, and keep post_max_size larger.

A second mistake is adding ini_set() lines to wp-config.php. Those lines do not change upload_max_filesize, because PHP does not allow that setting to change at runtime in that way. Use php.ini, .user.ini, or your host panel instead.

A third mistake is setting the limit to 1 GB or more for a site that only needs 64 MB. A very high limit lets any user who can upload fill the disk with large files. Set the limit to the largest file you plan to upload, plus a small margin.

Other mistakes to avoid:

  • Editing .htaccess on PHP-FPM, which causes a 500 error
  • Forgetting the Multisite cap of 1500 KB, which keeps uploads small on a network
  • Changing the limit and the theme at the same time, which hides the cause
  • Uploading a 200 MB video when a hosted video embed would serve it better

Check your PHP version while you are here. WordPress.org recommends PHP 8.3 or greater, with MySQL 8.4 or MariaDB 10.11 or greater. A newer PHP version handles large uploads more cleanly than an old one, and the Site Health screen shows the version your site runs.

Frequently asked questions

Why did the upload limit not change after I raised upload_max_filesize?

WordPress shows the smaller of upload_max_filesize and post_max_size, so raising only one leaves the limit at the lower value. Raise both, and keep post_max_size at least 16M above upload_max_filesize, because the request holds the file plus form fields.

Can I increase the upload size in wp-config.php?

No. upload_max_filesize is a per-directory PHP setting, so a line in wp-config.php will not raise it. Use your host PHP settings, php.ini, or .user.ini instead, and check the result in Tools > Site Health > Info > Media Handling.

How do I raise the upload limit on WordPress Multisite?

On Multisite, go to Network Admin > Settings and find Max upload file size under Upload Settings. It defaults to 1500 KB, about 1.5 MB. Enter the value in kilobytes, such as 65536 for 64 MB, and save the change.

Why does a large upload fail even after I raised the PHP limits?

Nginx has its own cap called client_max_body_size, which defaults to 1 MB on many servers. Ask your host to raise it, because WordPress cannot change it. A proxy or CDN in front of your site may add another cap as well.

What upload size should I choose for my site?

Set the limit to the largest file you plan to upload, plus a small margin. A photo site may need 32 MB, a theme zip may need 64 MB, and a video site may need 128 MB. A limit far above that lets uploads fill the disk faster.

Sources

  1. Description of core php.ini directives PHP.net
  2. Runtime Configuration PHP.net
  3. Network Admin Settings Screen WordPress Developer Resources
  4. Requirements WordPress.org
  5. How to Increase Maximum File Upload Size in WordPress Jetpack

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

WPLegible editors

Researched from the primary sources listed above and checked against our editorial rules. About the site · How we test