Troubleshooting · Troubleshooting
How to Fix "Uploaded File Exceeds upload_max_filesize" in WordPress
Short answer
The error means your file is larger than the upload_max_filesize limit set in your server's PHP settings. Open Media > Add New to see your current limit, then raise upload_max_filesize and post_max_size to at least the size of the file you want to upload. Use your host control panel, php.ini, .htaccess or wp-config.php, whichever your host allows.
Key takeaways
- The error means your file is larger than the PHP upload limit, not that the file is broken.
- Media > Add New shows your current limit under the uploader.
- post_max_size must be equal to or larger than upload_max_filesize.
- The PHP manual lists the default upload_max_filesize as 2M.
- If no file edit works, your host has locked the values and support must raise them.
What does the “uploaded file exceeds upload_max_filesize” error mean?
The error means your file is larger than the PHP upload limit on your server, not that the file is broken.
WordPress reads the limit from your server's PHP settings and shows it in the media uploader. The limit is set by your host, so you cannot change it from WordPress settings alone.
The PHP manual lists the default value of upload_max_filesize as 2M, which is why even a normal photo can hit the limit on some hosts. See the PHP manual on core php.ini directives.
The message names php.ini because that is the file where the limit lives. WordPress shows the file name to point you at the setting, not because WordPress set the limit itself.
Why do hosts set the upload limit so low?
Hosts cap uploads to stop one large file from using up shared server memory and disk space.
A 2 MB default is common on shared hosting, because hundreds of sites share one server. The PHP manual lists 2M as the default for upload_max_filesize, so a fresh PHP install starts there. See the PHP manual on core php.ini directives.
Large uploads also take longer, so a slow connection can hit the time limit before the file finishes. Raising max_execution_time to 300 gives big files five minutes to finish.
The cap also blocks abuse. Without a limit, an attacker could fill the server disk with junk uploads. A 64M limit is high enough for normal media and low enough to keep that risk small.
How do you check your current upload limit?
Open Media > Add New in your dashboard to see your current limit under the uploader.
The screen shows a line such as “Maximum upload file size: 2 MB”. That number is your upload_max_filesize value, so any file above it will fail.
You can also see the limit in Tools > Site Health > Info > Media Handling. WordPress.org's Site Health guide says this tab shows the maximum size of a single file you can upload.
The Server tab on the same screen shows the maximum upload file size too. It also lists your PHP version, so you can check both numbers in one visit.
Which three PHP settings control uploads?
Three PHP settings work together, and all three must allow your file size.
| Setting | What it limits | Value to set |
|---|---|---|
| upload_max_filesize | Size of one file | 64M |
| post_max_size | Size of the whole upload request | 64M or larger |
| memory_limit | Memory PHP can use per request | 256M |
The PHP manual states that post_max_size must be larger than upload_max_filesize, because the file travels inside a POST request. See the PHP manual on core php.ini directives.
The same manual lists the default memory_limit as 128M and the default number of files per upload as 20. See the PHP manual on core php.ini directives.
WordPress itself aims for 40 MB of memory on a single site and 64 MB on a multisite install. See the developer handbook on editing wp-config.php.
How do you raise the limit in your hosting control panel?
Use your host control panel first, because it is the fastest method and it writes the change for you.
- Open your host panel and find the PHP settings area, often called “MultiPHP INI Editor” or “PHP Options”.
- Set
upload_max_filesizeto 64M andpost_max_sizeto 64M or larger. - Save, wait a few minutes, then check Media > Add New again.
Some panels need a minute or two before the new value shows. If the number does not move, try the php.ini method below.
On cPanel hosts, the same settings live under “MultiPHP INI Editor”. Pick your site from the list, change the two size values, and save. The editor writes the change to the right php.ini file for your site, so you do not need to hunt for the file yourself.
How do you raise the limit with php.ini or .user.ini?
Create or edit php.ini in your site root when your host lets you change PHP settings by file.
upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 256M
max_execution_time = 300
Some hosts read .user.ini instead of php.ini, so create that file with the same lines if nothing changes. Wait a few minutes, because some hosts cache PHP settings.
If your host locks php.ini, the file method will not work. Move on to the next method or ask your host to raise the limit.
How do you raise the limit with .htaccess?
Add php_value lines to .htaccess if your site runs on Apache and your host allows it.
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value memory_limit 256M
php_value max_execution_time 300
Back up .htaccess first, because one wrong line can break the whole site. WordPress.org's common errors guide says a damaged .htaccess file is the most likely cause of an Internal Server Error.
If a bad .htaccess line breaks your site, see our guide to fixing the 500 Internal Server Error. This method does nothing on Nginx servers, which do not read .htaccess.
How do you raise the limit with wp-config.php?
Add @ini_set lines above the “That's all, stop editing!” line when you cannot reach the server settings.
@ini_set( 'upload_max_filesize', '64M' );
@ini_set( 'post_max_size', '64M' );
@ini_set( 'memory_limit', '256M' );
This works only when your host lets PHP change these values while the site runs. The developer handbook on editing wp-config.php notes that wp-config.php loads for every page view, so it can set PHP values on the fly.
If the limit shown in Media > Add New does not move, this method is blocked on your host. Try another method instead of adding more lines.
What should you do if the limit does not change?
Ask your host to raise the limit when no file method changes the number in Media > Add New.
Managed hosts often lock these values at the server level. A short support request with the exact size you need usually gets the limit raised.
The same limit blocks large site imports. Our guide to raising the All-in-One WP Migration import limit covers that case in detail.
WooCommerce's system status report also lists your Max Upload Size, which helps when you report the problem to support. WordPress.org recommends PHP 8.3 or greater, so ask your host to confirm your PHP version at the same time.
If uploads fail with a different message, see our guide to fixing the HTTP error when uploading images.
How do you confirm the fix worked?
Upload the same file again and watch for the success message in the media library.
Open Media > Add New first and read the limit line under the uploader. It should now show the new value, such as “Maximum upload file size: 64 MB”.
Then upload the file that failed before. If it lands in the media library without an error, the fix worked. Try a second file of a different type, such as a PDF, to make sure the change covers all uploads.
If the limit line still shows the old value, your change did not take effect. Go back through the methods in order and check for a second php.ini file or a host lock.
What mistakes should you avoid?
The most common mistake is raising only upload_max_filesize and leaving post_max_size smaller.
- Raising only
upload_max_filesizewhilepost_max_sizestays smaller. - Editing the wrong php.ini file on a server with more than one.
- Setting a 1 GB limit on shared hosting and hitting the memory limit instead.
- Forgetting to check Media > Add New after each change.
If you hit the memory limit instead, read our guide to fixing the allowed memory size error.
Frequently asked questions
What is a safe upload limit to set in WordPress?
64M suits most sites, because it covers large photos, PDFs and plugin ZIP files. Set 128M or 256M if you often upload videos or large media files. Keep post_max_size equal to or larger than upload_max_filesize, and keep memory_limit above both.
Why does the limit stay at 2 MB after I edited php.ini?
You may have edited the wrong php.ini file, or your host may read .user.ini instead. Some hosts also cache PHP settings for a few minutes, and some lock the values at the server level. Check Media > Add New after each change, and ask your host if no file edit moves the number.
Can I raise the upload limit with a plugin?
Some plugins offer a setting for the limit, but they cannot raise a cap your host enforces at the server level. The file methods in this guide are more reliable, because they change the PHP settings directly. Use a plugin only when you cannot reach php.ini, .htaccess or wp-config.php.
Does raising the limit slow down my site?
No, the limit only sets the largest file one upload may carry. It does not change how fast pages load. A large upload does use memory and time while it runs, so keep the limit near the largest file you truly need instead of setting it to 1 GB.
What is the difference between upload_max_filesize and post_max_size?
upload_max_filesize caps one file, while post_max_size caps the whole upload request, which is the file plus the form data around it. The PHP manual states that post_max_size must be larger than upload_max_filesize. If post_max_size is smaller, the upload fails even when the file fits the first limit.
Do I need to restart anything after changing php.ini?
Usually no restart is needed on shared hosting, but the new values can take a few minutes to show. Check Media > Add New to confirm the change. On a VPS or dedicated server, restart PHP through your host panel if the old value still shows after five minutes.
Sources
- Description of core php.ini directives PHP Manual
- Site Health screen WordPress.org Documentation
- Editing wp-config.php WordPress Developer Resources
- Common WordPress errors WordPress.org Documentation
- Requirements WordPress.org
- Understanding the WooCommerce System Status Report WooCommerce
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.
Thanks — we review requests within 3 business days.
