Increase the Maximum Upload File Size in WordPress
Three settings control your WordPress upload limit, and they all have to agree. The effective limit is the smallest of upload_max_filesize, post_max_size,
Published
Three settings control your WordPress upload limit, and they all have to agree. The effective limit is the smallest of upload_max_filesize, post_max_size, and your web server’s request cap. Raise one, leave the other two low, and nothing changes — which is exactly why most people conclude their fix “didn’t work.” Check your current numbers first with the WordPress max upload size tool; it reads the same values WordPress reports and shows you which one is holding you back.
Why the limit exists and where it lives
WordPress does not set the upload limit. It only reports it. When you see “The uploaded file exceeds the upload_max_filesize directive in php.ini,” that message comes straight from PHP.
Three separate values gate an upload, and the real ceiling is whichever is lowest:
upload_max_filesize(PHP) — the biggest single file PHP will accept.post_max_size(PHP) — the biggest total POST body. Your file rides inside the POST request along with other form fields, so this must be larger thanupload_max_filesize.- The web server’s body limit —
client_max_body_sizeon Nginx, orLimitRequestBodyon Apache. This one lives outside PHP entirely, which is why PHP-only fixes silently fail behind Nginx.
A fourth value, max_execution_time, does not cap size but will abort a slow large upload mid-transfer on a poor connection. It is a separate symptom, not part of the size ceiling.
The trap: you set upload_max_filesize = 256M, reload, still can’t upload a 100 MB file — because post_max_size is still 8M. PHP rejects the request on the total body before it ever inspects the file. The limit didn’t ignore you. A different limit caught it first.
How to fix it, in order
Work from most-likely-to-stick to last resort.
1. Edit php.ini (the correct place). Find the file your site actually loads — run a page with <?php phpinfo(); and read “Loaded Configuration File,” or ask your host. Set both PHP values, and keep post_max_size larger than upload_max_filesize:
upload_max_filesize = 256M
post_max_size = 260M
max_execution_time = 300
Restart PHP-FPM (sudo systemctl restart php8.2-fpm) or Apache. Changes do nothing until the PHP process restarts.
2. No php.ini access? Use .htaccess (Apache + mod_php only). Add to the .htaccess in your WordPress root:
php_value upload_max_filesize 256M
php_value post_max_size 260M
php_value max_execution_time 300
This only works when PHP runs as an Apache module. Under PHP-FPM, CGI, or FastCGI, php_value throws a 500 error — that failure means you’re on the wrong track, not that the number is wrong. Switch to .user.ini:
upload_max_filesize = 256M
post_max_size = 260M
3. Raise the web server limit — the step everyone forgets. On Nginx, PHP never even sees an oversized request; Nginx returns 413 Request Entity Too Large first. In your server block:
client_max_body_size 256M;
Reload with sudo nginx -t && sudo systemctl reload nginx. If you’re on Nginx and your PHP edits “did nothing,” this is almost always why.
After any change, re-check the reported values. The max upload size tool will tell you the new effective ceiling and generate the exact snippet for your setup, so you’re not guessing which of the three is still low.
What not to do
Don’t edit wp-config.php and expect it to lift the limit. The widely-copied line does not do what the blog posts claim:
@ini_set( 'upload_max_filesize' , '256M' );
upload_max_filesize is PHP_INI_PERDIR. It cannot be changed from PHP at runtime with ini_set(). It only accepts new values from php.ini, .htaccess, or .user.ini — never from application code. The line runs without error and does nothing, which makes it one of the most confidently repeated pieces of wrong advice in WordPress.
Don’t paste @ini_set('post_max_size', ...) either — same restriction, same silent no-op.
Don’t set WP_MEMORY_LIMIT and think it’s the upload limit. That controls PHP’s memory ceiling for running code. It’s unrelated to how large a file the server accepts.
Don’t stop at one file. The single most common failure is changing upload_max_filesize alone and declaring the fix broken. Change all three, and keep post_max_size above upload_max_filesize.
Don’t set limits absurdly high “to be safe.” A 2 GB limit invites resource-exhaustion problems and doesn’t help — if you genuinely need multi-gigabyte files, upload them outside the browser (SFTP, or a chunked-upload plugin) rather than forcing them through a single PHP POST.
Still stuck?
If all three values are raised and you still hit a wall, the request is being capped somewhere upstream of your server: a CDN or proxy (Cloudflare’s dashboard caps upload body size on its own), a managed host’s platform limit that ignores your php.ini, or a .user.ini that hasn’t refreshed yet — it honors PHP’s user_ini.cache_ttl, so it can lag a few minutes after you save. Confirm what the server actually reports, not what you wrote in a file, and fix the layer that’s still low. When the reported number finally matches your target, the upload works.