AI Overview
The upload_max_filesize error means your file is larger than your server's PHP upload limit. To increase max upload size in WordPress, raise upload_max_filesize and post_max_size in your host's control panel, php.ini or a .user.ini file, keep memory_limit larger than both, and on Nginx raise client_max_body_size. wp-config.php cannot change it.
Key takeaways
- WordPress's upload limit is the smaller of PHP's upload_max_filesize and post_max_size.
- Change the limit in your host's control panel, php.ini or a .user.ini file.
- .htaccess php_value lines only work on Apache with mod_php and cause 500 errors elsewhere.
- wp-config.php can raise WP_MEMORY_LIMIT but cannot raise the upload size.
- A 413 Request Entity Too Large error means Nginx's client_max_body_size is too low.
Free WordPress plugin
Know which plugin update broke your site.
The free MyKavo plugin watches your site through every plugin, theme and core update, and tells you which one caused a change, before your visitors find it.
- Records every plugin, theme and WordPress update
- Checks your key pages right after each update and names the one that broke something
- One-click rollback when an update goes wrong, free
- Changes, alerts and before-and-after proof inside wp-admin
Free on WordPress.org · WordPress 6.2+ · PHP 7.4+ · The check after each update comes with every paid plan
Summarize with AI
Opens the assistant in a new tab with a link to this post.
On this page
If WordPress says "The uploaded file exceeds the upload_max_filesize directive in php.ini," your file is bigger than the upload limit your server's PHP configuration allows. WordPress can't raise that limit by itself: you have to increase it in PHP (and sometimes in your web server too), usually through php.ini, a .user.ini file or your hosting control panel.
This guide shows how to check your current limit, which PHP settings control it, and every way to increase max upload size in WordPress: php.ini, .user.ini, .htaccess, host control panels, Nginx's client_max_body_size, and the separate multisite setting. It also covers why the popular wp-config.php trick doesn't work.
Changing server settings on a live site? The free MyKavo WordPress plugin checks your pages after every plugin, theme and core update and tells you exactly what changed. Start monitoring free.
Quick answer: how to increase max upload size in WordPress#
- Check your current limit under Media > Add New Media File, or in Tools > Site Health > Info.
- Raise
upload_max_filesizeandpost_max_sizein your host's PHP settings, php.ini or a.user.inifile, keepingpost_max_sizea bit larger. - Make sure
memory_limitis larger thanpost_max_size, and raisemax_execution_timefor big files. - On Nginx, raise
client_max_body_sizetoo, or uploads fail with "413 Request Entity Too Large." - On multisite, raise "Max upload file size" under Network Admin > Settings.
- Reload Media > Add New Media File to confirm the new limit.
If you're on shared hosting and none of these are available to you, ask your host's support to raise the limit. It's a routine request.
Check your current upload limit#
Before changing anything, find out what the limit is and where it comes from.
- Media > Add New Media File (called "Add New" in older versions) shows "Maximum upload file size" under the upload area.
- Tools > Site Health > Info lists the values in two sections. Media Handling shows the maximum upload size WordPress will accept, and Server shows PHP's own upload, post size, memory and time limits.
The number WordPress shows is the smaller of upload_max_filesize and post_max_size. If one is raised and the other isn't, nothing changes. Our WordPress Site Health guide explains the rest of that screen.
The PHP settings that control uploads#
| Setting | What it limits | PHP default | Suggested for media-heavy sites |
|---|---|---|---|
upload_max_filesize | Size of a single uploaded file | 2M | 64M to 256M |
post_max_size | Total size of the whole upload request | 8M | Slightly larger than upload_max_filesize |
memory_limit | Memory one PHP process can use | 128M | Larger than post_max_size, e.g. 256M |
max_execution_time | Seconds a script can run | 30 | 120 to 300 for large uploads |
max_input_time | Seconds allowed to receive the upload | Varies by host | Match max_execution_time |
The defaults are PHP's own (listed in the php.ini directives reference); many hosts set higher values. The rule to remember: memory_limit should be larger than post_max_size, and post_max_size should be larger than upload_max_filesize.
Use PHP's shorthand units: 64M, 1G. Writing 64MB is not valid and PHP may read it incorrectly.
Only raise limits as far as you need. Very large limits make it easier for someone to tie up your server with huge requests, and big media files are better served from a video host or offload service anyway.
Method 1: Your hosting control panel (easiest)#
Most hosts let you change PHP settings without touching files. This is the safest option because the host writes the configuration in the right place for their setup.
- cPanel: look for MultiPHP INI Editor (or "Select PHP Version" then "Options" on CloudLinux hosts). Choose your domain and edit
upload_max_filesize,post_max_size,memory_limitandmax_execution_time. - Plesk: open the domain's PHP Settings and change the same values.
- Managed WordPress hosts: many have a PHP settings page in their dashboard; some only change limits through support.
Save, wait a minute, then recheck Media > Add New Media File.
Method 2: Edit php.ini#
If you run your own server (VPS or dedicated) or your host gives you a php.ini file, edit it directly:
upload_max_filesize = 64M
post_max_size = 80M
memory_limit = 256M
max_execution_time = 300
max_input_time = 300
To find the right file, look at "Loaded Configuration File" in a phpinfo() page, or check with your host. Running php --ini over SSH shows the CLI configuration, which is often a different file from the one your web server uses.
After saving, restart PHP so it reads the new values. On a server using PHP-FPM, that's typically:
sudo systemctl restart php8.3-fpm
Replace 8.3 with your PHP version. If you use Apache with mod_php, restart Apache instead. Our guide on WordPress PHP versions shows how to check which one you're running.
Try it on your site · free
Check your own page's meta tags
Title, description, canonical and robots - including an accidental noindex - in a few seconds.
Method 3: Create a .user.ini file#
On many shared hosts that run PHP through PHP-FPM or CGI, you can't edit the main php.ini, but PHP reads a file called .user.ini in your site's folder.
- In your WordPress root folder (where
wp-config.phplives), create a file named.user.ini. - Add the same lines as the php.ini example above.
- Save and wait. PHP caches
.user.inifor 300 seconds by default, so changes can take up to five minutes to apply.
If nothing changes after a few minutes, your host may not support .user.ini, or may use a different file name. Check their documentation or ask support.
Method 4: .htaccess (Apache with mod_php only)#
Many older guides suggest adding this to .htaccess:
php_value upload_max_filesize 64M
php_value post_max_size 80M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300
This only works when Apache runs PHP as a module (mod_php). Most modern hosts run PHP-FPM instead, and on those servers php_value lines cause a 500 Internal Server Error for the whole site. If that happens, remove the lines immediately via SFTP or your file manager.
Back up .htaccess before editing it, and keep a copy you can restore quickly. Our WordPress backup guide covers what else to save before server changes.
Why wp-config.php can't raise the upload limit#
A common tip is to add this to wp-config.php:
@ini_set( 'upload_max_filesize', '64M' );
@ini_set( 'post_max_size', '80M' );
It doesn't work. PHP only allows upload_max_filesize and post_max_size to be set in php.ini, .user.ini, .htaccess or the server configuration. By the time WordPress loads, the upload limits are already fixed for that request, and ini_set() silently fails.
What wp-config.php can do is raise WordPress's memory allowance, because memory_limit can change at runtime:
define( 'WP_MEMORY_LIMIT', '256M' );
That helps when large image uploads fail during processing, but it won't change the maximum upload size. Our guide to the WordPress memory limit explains WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT in detail.
Plugins and code can also lower the limit with WordPress's upload_size_limit filter, but nothing in WordPress can raise it above what PHP allows.
Method 5: Nginx client_max_body_size (413 Request Entity Too Large)#
If your upload fails with "413 Request Entity Too Large" or a generic "HTTP error" in the media uploader, your web server rejected the request before PHP ever saw it. On Nginx, the default request body limit is just 1 MB.
Add or raise client_max_body_size in your Nginx configuration, inside the http, server or location block for your site:
server {
# ...existing configuration...
client_max_body_size 80M;
}
Match it to your post_max_size. Then test and reload Nginx:
sudo nginx -t
sudo systemctl reload nginx
On managed hosting you can't edit Nginx yourself, so ask support. Proxies and CDNs have their own limits too: Cloudflare's documentation lists a 100 MB request body limit on its Free and Pro plans, so very large uploads through Cloudflare need a different route, such as SFTP plus WP-CLI.
Method 6: Multisite network upload limit#
WordPress multisite adds its own limit on top of PHP's. Even with PHP set to 64M, sites on the network can be capped lower.
- Go to Network Admin > Settings > Network Settings.
- Under Upload Settings, raise Max upload file size (it's in kilobytes, so 64 MB is 65536 KB).
- Check Site upload space too, which caps total storage per site if enabled.
- Save, then check the limit from an individual site's Media > Add New Media File.
The effective limit is still the smallest of the network setting, upload_max_filesize and post_max_size.
Still failing? Other upload errors#
| Error or symptom | Likely cause | Fix |
|---|---|---|
| "exceeds the upload_max_filesize directive in php.ini" | upload_max_filesize too low | Raise it with any method above |
| "exceeds the maximum upload size for this site" | WordPress's computed limit (PHP or multisite) | Raise PHP limits; check network setting |
| "413 Request Entity Too Large" | Nginx client_max_body_size or a proxy limit | Raise it on the server or CDN |
| "HTTP error" in the uploader | Timeout, memory or a server limit | Raise max_execution_time and memory; check server logs |
| "Post-processing of the image failed" | Image too large for available memory | Resize before upload; raise memory limit |
| Limit didn't change after editing | Wrong file, cache, or PHP not restarted | Confirm the loaded config file; restart PHP; wait for .user.ini cache |
If uploads fail with no clear message, turn on WordPress debug mode and check the log for the real error.
Upload huge files without raising limits#
For one-off large files, skip the browser entirely. Upload the file via SFTP, then import it into the Media Library with WP-CLI:
wp media import /path/to/large-video.mp4 --title="Product demo"
WP-CLI runs PHP from the command line, so it isn't affected by the web upload limits.
Keep uploads from slowing your site#
Raising the limit makes it easier to upload very large files, and large files end up on your pages. Compress images before uploading, use modern formats like WebP or AVIF where your setup supports them, and host long videos on a video platform rather than in the Media Library. Our guide on how to speed up WordPress covers image optimization, and the free page size checker shows how heavy a page has become.
How to catch heavy pages and broken changes automatically#
Server changes and big uploads tend to cause problems you don't see right away: a .htaccess edit that breaks the site, or a 20 MB image that quietly doubles a page's weight.
MyKavo watches the pages you choose and re-scans them on a schedule (weekly on the Free plan, daily on paid plans). It alerts you when a page's HTTP status changes (for example to a 500 error), when page weight or request count jumps, or when the page changes visually, with before-and-after screenshots and a severity. The free MyKavo WordPress plugin also checks your pages after every plugin, theme and WordPress core update and names the update when something broke. After a config change, clear your cache so you're testing the live result.
Frequently asked questions#
Frequently asked questions
How do I fix "the uploaded file exceeds the upload_max_filesize directive in php.ini"?
Raise upload_max_filesize and post_max_size in your host's PHP settings, php.ini or a .user.ini file, keeping post_max_size slightly larger. Restart PHP or wait a few minutes, then check the new limit under Media > Add New Media File.
What is the default max upload size in WordPress?
WordPress has no fixed default; it uses your server's PHP limits. PHP's own defaults are 2 MB for upload_max_filesize and 8 MB for post_max_size, but most hosts set higher values, often between 32 MB and 256 MB.
Can I increase the upload size in wp-config.php?
No. PHP doesn't allow upload_max_filesize or post_max_size to be changed from wp-config.php. You can raise WP_MEMORY_LIMIT there, but the upload size must be changed in php.ini, .user.ini, .htaccess (mod_php only) or your host's control panel.
Why didn't my php.ini change work?
You may have edited a file PHP doesn't load, such as the CLI php.ini instead of the web one, or PHP hasn't been restarted. Check "Loaded Configuration File" in phpinfo(), restart PHP-FPM, and remember .user.ini changes can take five minutes.
What does 413 Request Entity Too Large mean in WordPress?
Your web server or proxy rejected the upload before PHP received it. On Nginx, raise client_max_body_size to match post_max_size and reload Nginx. On managed hosting, ask your host to raise it.
How do I increase the upload limit on WordPress multisite?
Go to Network Admin > Settings > Network Settings and raise Max upload file size, which is set in kilobytes. The PHP limits must also be high enough, because the smallest limit always wins.
Is it safe to set a very high upload limit?
Only as high as you need. Very large limits let a single request use more server resources, and huge files slow pages down. For big videos, use a video host or upload via SFTP and WP-CLI instead.
The bottom line#
The upload limit lives in PHP, not WordPress. Check your current limit in Media or Site Health, then raise upload_max_filesize and post_max_size through your host's control panel, php.ini or .user.ini, keeping memory_limit above both. If you see a 413 error, raise Nginx's client_max_body_size as well, and on multisite raise the network setting. Skip the wp-config.php trick: it can't change the upload size.
Know when a server change breaks something. Start monitoring your site free with MyKavo and install the free MyKavo WordPress plugin, no card needed.
Write for MyKavo
Know website monitoring, WordPress or SEO from real work? Pitch us a guide. You keep a byline with one link to your site. Read the guidelines
Get alerted when your site breaks. Free, no card.
Start free