Increase the WordPress Upload Limit: Uploading Larger Files
In short
The upload limit lives in PHP, not in WordPress: upload_max_filesize caps a single file, post_max_size caps the whole request, and you set both in php.ini, .user.ini or (mod_php only) .htaccess. wp-config.php and ini_set do not help, because PHP needs these values before your code runs. On Nginx, client_max_body_size adds a second limit; on multisite, a network setting does.
You want to upload a larger image, a theme, or a video, and WordPress stops you: “The uploaded file exceeds the upload_max_filesize directive in php.ini.” The limit is set server-side and is usually quick to raise. The catch is that several layers can block an upload, so you need to change the right one.
Why does the message appear?
The message comes from PHP. In the PHP manual it is the error code UPLOAD_ERR_INI_SIZE: the file is larger than upload_max_filesize. WordPress just shows it to you. Three values interact behind it:
upload_max_filesize: the maximum size of a single file. According to the manual, PHP’s default is 2 MB; most hosts set more.post_max_size: the maximum size of the whole request, default 8 MB. The manual says this value must be larger thanupload_max_filesize. If the request exceeds it,$_POSTand$_FILESare empty. WordPress then sees no file, and you may not even get a clean error message.memory_limit: the manual says it should be larger thanpost_max_size. So the order ismemory_limit>post_max_size>upload_max_filesize.
WordPress displays the smaller of upload_max_filesize and post_max_size as your limit; the function wp_max_upload_size() does exactly that. If you raise only one of the two, nothing visibly changes.
Where’s Your Current Limit?
In WordPress you’ll see it under Media → Add New (“Maximum upload file size”) and in detail under Tools → Site Health → Info → Server, where upload_max_filesize and post_max_size are listed separately. If the displayed value differs from what you configured, another layer is taking precedence. More on that below.
Raising the Limit
Which file works depends on your hosting. Work through them top to bottom. Pick a value, copy the matching snippet:
PHP Limits Generator
Set a PHP limit
Pick a limit, copy the right file. Everything runs in your browser.
Your input never leaves the browser. Snippets are generated locally via JavaScript.
Also available as a standalone page with all guides: PHP limits generator.
Host control panel
Many hosts have a PHP section in the customer area with fields for upload_max_filesize and post_max_size. It’s the simplest route and the hardest to break. If you find the values there, use them before touching files.
php.ini
On your own server or VPS you edit php.ini and reload PHP-FPM or the web server. According to the manual both directives use the mode PHP_INI_PERDIR, so they can be set in php.ini.
upload_max_filesize = 128M
post_max_size = 136M
memory_limit = 256M
.user.ini
On PHP-FPM, FastCGI and CGI you put a .user.ini file in the WordPress root directory. The manual names the CGI/FastCGI SAPI for this. The syntax is KEY=VALUE, not php_value.
upload_max_filesize = 128M
post_max_size = 136M
PHP doesn’t re-read .user.ini on every request but according to user_ini.cache_ttl, which defaults to 300 seconds. That explains why a change can take up to five minutes. If you have host access and want to check right away, reloading the PHP service also works.
.htaccess
The lines php_value upload_max_filesize and php_value post_max_size in .htaccess only work, per the manual, when PHP runs as an Apache module (mod_php). On FPM or FastCGI, php_value often causes a 500 error. Then the setting belongs in .user.ini.
php_value upload_max_filesize 128M
php_value post_max_size 136M
Why wp-config.php doesn’t help
Unlike the memory limit, there is no WordPress constant for the upload size. ini_set() in code, say in wp-config.php or a plugin, doesn’t work either: upload_max_filesize and post_max_size have the mode PHP_INI_PERDIR, and according to the manual such values can’t be changed at runtime with ini_set(). The reason is simple: PHP has to accept or reject the file while reading the request, before your code runs.
The Web Server Can Stop Earlier: Nginx and 413
If your site runs on Nginx, there’s a second limit that has nothing to do with PHP. client_max_body_size caps the size of the request body, and per the Nginx documentation the default is 1 MB. If a request exceeds it, Nginx answers 413 Request Entity Too Large, and PHP never learns about the upload. That’s why even a perfect upload_max_filesize doesn’t help then.
server {
client_max_body_size 128M;
}
The value can sit in the http, server or location block. Setting it to 0 turns the check off, which I wouldn’t do on a public site. Test the configuration and reload afterwards. On managed hosting you usually can’t do this yourself, so it’s a job for support.
Time: max_execution_time and max_input_time
Large files take time even when the size limits are right. Two directives matter:
max_input_timelimits, per the manual, how long PHP may parse input data such as POST. The default is-1, which meansmax_execution_timeapplies. On a slow connection a big upload can fail here.max_execution_timeis the script runtime, default 30 seconds. It becomes relevant when WordPress generates image sizes after the upload. The article on maximum execution time exceeded covers that error.
Multisite: The Network Setting
In a multisite network, Network Admin → Settings has a field “Max upload file size”. According to the WordPress documentation the default is 1500 KB. In WordPress core the filter upload_size_limit_filter takes the smaller of the PHP limit and this setting, and also the site’s remaining storage space while the space check is active. If you raised PHP and still see a small limit, look here first.
Limiting by Code: the upload_size_limit Filter
The upload_size_limit filter lets you change the limit WordPress displays and checks. It receives the computed size plus both PHP values in bytes. It’s handy for lowering the limit, for example for editors:
add_filter( 'upload_size_limit', function ( $size ) {
if ( ! current_user_can( 'manage_options' ) ) {
return 10 * MB_IN_BYTES;
}
return $size;
}, 20 );
You can’t use it to lift the PHP limit. The filter changes what WordPress shows, but PHP still rejects files that are too large.
Typical Error Patterns
- “The uploaded file exceeds the upload_max_filesize directive in php.ini”: the single file is larger than
upload_max_filesize. Raise it. - Upload aborts or the file doesn’t show up although
upload_max_filesizeis high enough: checkpost_max_size. If it’s smaller, the file doesn’t arrive. - 413 Request Entity Too Large: the web server, usually Nginx, rejected the request. Raise
client_max_body_size. - The value doesn’t change: host limit,
.user.inicache, wrong file for your PHP setup, or the multisite setting. - Upload works but the image or its thumbnails are missing: usually image processing, so memory limit or runtime.
Large Images: Memory Limit and the 2560-Pixel Threshold
With large uploads, especially images, processing follows the upload. WordPress generates several preview sizes, and that needs memory. A generous upload limit helps little if the image processing afterwards fails at the memory limit.
Since WordPress 5.3, WordPress also scales very large images down automatically. According to the developer documentation the filter big_image_size_threshold defaults to 2560 pixels as maximum width and height. The original is kept, but WordPress continues with the scaled version. A photo that is 6000 pixels wide therefore gets a smaller working copy, which saves storage and delivery weight. The upload limit still applies to the original file. To switch scaling off, return false:
add_filter( 'big_image_size_threshold', '__return_false' );
I’d only do that if you really need to serve the originals at full resolution. Per the documentation, PNG files are excluded from this scaling.
Very Large Files: SFTP and WP-CLI
If you regularly need files beyond a few hundred megabytes, the browser upload is the wrong tool. Better: put the file on the server via SFTP and import it into the media library with WP-CLI. According to the WP-CLI documentation, wp media import creates attachments from local files or URLs and understands glob patterns.
wp media import /path/to/images/*.jpg --porcelain
The import runs on the command line and isn’t subject to the browser upload limits. For videos, many people use an external service rather than keeping them in the media library.
The Order I Check In
When an upload fails, I go through this:
- Read the message. If it says
upload_max_filesize, it’s the single file. If it’s a 413, it’s the web server. - Compare the values shown in Site Health with what you configured.
- Set
post_max_sizeat least as large asupload_max_filesize, andmemory_limitabove both. - With
.user.ini, wait five minutes or reload PHP, then check again. - On multisite, look at the network setting.
- Only when everything is right and the value still doesn’t arrive, ask the host whether there’s a fixed limit.
Still No Effect?
Then your host has set a lower hard limit that takes precedence. Ask for the maximum permitted value. Many shared hosting plans cap out at 64 or 128 MB. Other error patterns can be sorted out via the overview of WordPress errors.
If the upload still fails despite the change, or you’d rather not touch the server files: drop us a line – we’ll set the right limit.
Frequently Asked Questions
How do I increase the upload limit in WordPress?
Via a PHP configuration file: php.ini if you control the server, .htaccess on Apache with mod_php, or .user.ini on PHP-FPM and FastCGI. There you set upload_max_filesize and post_max_size to higher values. The upload size can't be set in wp-config.php. The generator on this page produces the matching snippet.
Why does post_max_size matter?
upload_max_filesize limits the single file, post_max_size the entire request. According to the PHP manual, post_max_size must be larger than upload_max_filesize. If post_max_size is exceeded, $_POST and $_FILES are empty, so the file never reaches WordPress at all.
Where do I see the current upload limit?
Under Media, Add New you see the maximum upload file size. In more detail, Tools, Site Health, Info, Server lists upload_max_filesize and post_max_size. That's also where you check after a change whether the new value was applied.
Why doesn't the limit change right after I save?
With a .user.ini file PHP only re-reads the file every user_ini.cache_ttl seconds, which defaults to 300, so five minutes. With PHP-FPM on your own server or in a host panel, a reload or restart of PHP may also be needed. Wait a moment, then check the value in Site Health.
What does 413 Request Entity Too Large mean on upload?
The web server rejected the request before PHP saw it. On Nginx that is client_max_body_size, which defaults to 1 MB. Raise it in the site's Nginx block and reload the configuration. The PHP values alone won't fix it.
Why does my multisite show a smaller limit than PHP allows?
Network settings have a Max upload file size option. WordPress takes the smaller of the PHP limit and that setting; the documented default is 1500 KB. Change it under Network Admin, Settings.
How do I upload files larger than any limit?
Put the file on the server via SFTP and import it with WP-CLI using wp media import. That bypasses the browser upload limits. Videos are often better hosted with an external video service anyway.
Related Services
Founder & Full-Stack Developer
20+ years of web development experience. Specialised in Laravel, WordPress and custom software for mid-sized businesses.