Skip to content
Configuration

How to Increase the Upload Limit in WordPress (Any Host)

Check your current WordPress upload limit, then raise it in the right place for your host: php.ini, .user.ini, .htaccess, cPanel, Nginx or Cloudflare.

Published Updated

To increase the upload limit in WordPress, raise two PHP settings, upload_max_filesize and post_max_size, in the configuration file your host actually reads. That is php.ini on a server you control, .user.ini on most shared hosts that run PHP-FPM (“FastCGI Process Manager,” the way most shared hosts run PHP as its own background process rather than inside Apache) or plain FastCGI, .htaccess only when Apache runs PHP as a module, or the MultiPHP INI Editor in cPanel. If your server runs Nginx, also raise client_max_body_size. Editing wp-config.php will not change the upload limit.

Think of upload_max_filesize as the size cap on the file itself, and post_max_size as the cap on the envelope that file travels in alongside the rest of the form data. Raise only the file cap and leave the envelope too small, and the envelope rejects the delivery before WordPress ever gets to check the file. That is why the two settings move together in every example below.

The WordPress max upload size tool turns one target size into matching lines for php.ini (or .user.ini), .htaccess and wp-config.php, so you can paste instead of typing them by hand. Use the php.ini, .user.ini or .htaccess block for the upload limit itself, in whichever file your host actually reads; the wp-config.php block it also generates cannot raise the upload limit, for the reason the “Why wp-config.php does not work” section below explains.

Step 1: Check your current upload limit

A theme ZIP, a batch of full-resolution photos, or a video for a landing page is usually what triggers this: the upload bar fills, then WordPress stops it with an error that names no file size at all, just “exceeds the maximum upload size for this site.” Before changing anything, find out what that limit actually is right now and which setting controls it, so you are not guessing at a number to raise.

  • Media > Add New. The upload screen shows the maximum upload file size. This is the number you are trying to raise.
  • Tools > Site Health > Info. Expand Media handling. The Site Health documentation lists what it shows there: max size of post data allowed, max size of an uploaded file, and max effective file size, which is the smaller of the two. The Server section shows more PHP values.
WordPress Upload Media screen with the line Maximum upload file size: 2 GB below the upload area
Where the limit shows on the upload screen, under the upload area. The 2 GB is our test server’s value; many hosts set far less.
WordPress Site Health Info, Media Handling section, listing max size of post data allowed, max size of an uploaded file and max effective file size
Tools > Site Health > Info > Media Handling on our test site, with the post data, uploaded file and effective limits on separate rows.

WordPress calculates its limit in wp_max_upload_size(), which reads upload_max_filesize and post_max_size from PHP and uses the smaller one. If one of them is 64M and the other is 8M, your limit is 8M.

On a Multisite network, there is a third ceiling. wp_max_upload_size() passes its result through the upload_size_limit filter, and Multisite hooks that filter to cap uploads at the network’s “Max upload file size” setting (Network Admin > Settings), which defaults to 1500 KB. Raising upload_max_filesize and post_max_size on a subsite does nothing until you also raise that network setting above the PHP limit you just set.

Step 2: Know which settings matter

SettingWhat it limitsPHP defaultWhere it can be changed
upload_max_filesizeThe largest single uploaded file2Mphp.ini, .user.ini, .htaccess, httpd.conf
post_max_sizeThe whole POST request, file included8Mphp.ini, .user.ini, .htaccess, httpd.conf
memory_limitMemory PHP can use while running128MAnywhere, including wp-config.php
max_execution_timeSeconds a script may run30Anywhere, including wp-config.php
client_max_body_size (Nginx)The request body Nginx will accept1mNginx config only

The PHP defaults and change modes come from the php.ini directives list; the Nginx default comes from the Nginx core module documentation. Most hosts set higher values than PHP’s defaults, which is why Site Health is the place to read your real numbers.

upload_max_filesize and post_max_size are what PHP calls INI_PERDIR settings, meaning PHP locks them to config files and refuses to let any PHP code, including WordPress itself, change them at runtime: they “can be set in php.ini, .htaccess, httpd.conf or .user.ini” and nowhere else. memory_limit does not cap file size, but WordPress needs memory to create resized copies of large images, so a big upload can still fail with a memory exhausted error after it arrives.

How high should you set it?

Decide this before you touch a config file, so you only have to edit it once. Set it to the largest file you actually need to upload, with a little headroom, and keep post_max_size slightly above upload_max_filesize. Large uploads also take longer, so raise max_execution_time if big files time out on slow connections. For very large files such as long videos or backup archives, uploading through SFTP or a chunked upload plugin is usually more reliable than one huge browser upload, and a Cloudflare plan limit may rule out the browser route anyway.

The steps below use 128M and 130M as a working example. Swap in your own target size, or let the max upload size tool write the matching php.ini, .user.ini or .htaccess lines for whatever number you pick.

Step 3: Raise the limit in the right place for your host

Your setupWhere to set itNotes
VPS or dedicated serverThe php.ini your PHP actually loadsRestart PHP-FPM or Apache afterwards
Shared host using PHP-FPM or FastCGI.user.ini in the WordPress rootCan take up to 5 minutes to apply
Apache with PHP as a module (mod_php).htaccess with php_valueCauses a 500 error under PHP-FPM or FastCGI
cPanel hostSoftware > MultiPHP INI EditorWrites php.ini, .user.ini or .htaccess for you
Nginx in front of PHPclient_max_body_size as well as the PHP valuesOtherwise Nginx returns 413
Managed WordPress hostThe host’s dashboard or supportSome hosts cap uploads at platform level
Site behind CloudflareCloudflare’s own upload limit100 MB on Free and Pro plans

php.ini (server you control)

Find the loaded file first. Create a temporary file containing <?php phpinfo();, open it in a browser, read the “Loaded Configuration File” line, then delete the file. Edit that php.ini:

upload_max_filesize = 128M
post_max_size = 130M
max_execution_time = 300

Then restart PHP so it reads the change. With PHP-FPM, the service name includes the version, for example sudo systemctl restart php8.3-fpm on Debian or Ubuntu. With mod_php, restart Apache.

.user.ini (most shared hosting)

PHP reads .user.ini files only when it runs as CGI or FastCGI (the modes where PHP runs as a separate process that Apache or Nginx hands requests to, instead of living inside Apache as mod_php), which includes PHP-FPM. Create or edit .user.ini in the folder that contains wp-config.php:

upload_max_filesize = 128M
post_max_size = 130M

PHP rereads these files every user_ini.cache_ttl seconds, which defaults to 300. Wait five minutes before deciding it did not work, or restart PHP-FPM if you can.

.htaccess (Apache with mod_php only)

php_value upload_max_filesize 128M
php_value post_max_size 130M

The PHP manual describes these directives for PHP running as an Apache module. If your site shows a 500 Internal Server Error right after you save this, PHP is running as FastCGI or PHP-FPM. Remove the lines and use .user.ini instead.

cPanel MultiPHP INI Editor

In cPanel, open Software > MultiPHP INI Editor, choose your domain, and change the values in Basic Mode. According to cPanel’s documentation, Basic Mode saves to the php.ini, .user.ini and .htaccess files where each one supports the setting, so you do not need to know which one your server uses.

Nginx

Nginx checks the request size before PHP sees it. When a request is larger than client_max_body_size, Nginx returns 413 Request Entity Too Large. The default is 1m. Add a value at least as large as post_max_size in your server block:

client_max_body_size 130M;

Test and reload with sudo nginx -t && sudo systemctl reload nginx. On Apache, the comparable setting is LimitRequestBody. Its own documentation gives the current default as 1 GiB (it was unlimited by default before Apache httpd 2.4.54), so it rarely needs changing on standard WordPress hosting unless you are raising uploads past 1 GiB or an older Apache version left it unlimited.

Managed hosts and Cloudflare

A managed WordPress host can ignore your php.ini or .user.ini and set the limit for the whole platform; this varies by host, and some do not. If Site Health still shows the old number after your change, ask your host what the maximum is and whether they can raise it.

If the site runs through Cloudflare, Cloudflare has its own limit. Its cache documentation lists maximum upload sizes of 100 MB on Free and Pro plans, 200 MB on Business, and up to 5 GB on Enterprise. No PHP setting can get past that.

Why wp-config.php does not work

Many articles suggest adding this to wp-config.php, and the max upload size tool will also hand you something close to it if you copy its wp-config.php output:

@ini_set( 'upload_max_filesize', '128M' );
@ini_set( 'post_max_size', '130M' );

Both settings are INI_PERDIR, and PHP’s documentation says settings of that mode may not be set with ini_set(). There is no warning to hide: ini_set() just returns false for an INI_PERDIR setting and moves on, so the @ is not doing anything here. The lines run without an error and change nothing, which is easy to miss because nothing looks wrong.

wp-config.php genuinely can raise memory for WordPress’s own admin and image-processing work, but not through WP_MEMORY_LIMIT. Our wp-config.php guide covers the constant that actually applies here, WP_MAX_MEMORY_LIMIT:

define( 'WP_MAX_MEMORY_LIMIT', '256M' );

WordPress’s own wp_raise_memory_limit() uses WP_MAX_MEMORY_LIMIT (default 256M, or your php.ini memory_limit if that is already higher) as the ceiling when resizing images in the admin area. WP_MEMORY_LIMIT only covers everyday admin requests, not that higher image-processing ceiling, which is why a large upload can still trail off into a memory exhausted error if WP_MAX_MEMORY_LIMIT is left too low. None of this changes the maximum upload file size itself, which is still set by upload_max_filesize and post_max_size in php.ini, .user.ini or .htaccess.

Step 4: Confirm the change

Reload Media > Add New and check that the maximum upload file size shows your new value. If it does not:

  • Check that post_max_size is at least as large as upload_max_filesize. WordPress uses the smaller one.
  • Confirm you edited the file PHP actually loads. A php.ini in the wrong folder is ignored.
  • Wait five minutes for a .user.ini change, or restart PHP-FPM.
  • If the number in WordPress changed but uploads still fail with 413, the block is in Nginx, your host’s proxy or Cloudflare.
  • If the upload reaches WordPress and then fails with “HTTP error,” the size is no longer the problem. Our guide to the WordPress HTTP error on image upload covers the usual causes.

If you add the .htaccess lines from Step 3 and the file already handles permalinks or redirects, add them as a new block rather than replacing anything; our guide to the default WordPress .htaccess file shows what WordPress’s own rules look like, so you can tell your addition apart from them. When you know your target size, the max upload size tool writes the matching php.ini, .user.ini and .htaccess lines for you; add the Nginx line from this guide yourself if your server runs Nginx.

William Lopez

William Lopez is the founder of Odie Themes. He builds the free WordPress tools and themes on this site and has been on WordPress.org since December 2019.

WordPress.org About

FAQ

Questions

How do I check my current upload limit in WordPress?

Go to Media > Add New. The upload screen shows the maximum upload file size. For the detail behind it, open Tools > Site Health > Info and expand Media handling, which lists the max size of an uploaded file, the max size of post data, and the max effective file size, which is the smaller of the two.

Why does WordPress say the uploaded file exceeds the upload_max_filesize directive in php.ini?

The file is larger than PHP's upload_max_filesize setting. WordPress does not set this limit, it reads it from PHP. Raise upload_max_filesize and post_max_size together in php.ini, .user.ini or, on Apache with mod_php, .htaccess. PHP's own default for upload_max_filesize is only 2M, although most hosts set a higher value.

Can I increase the upload limit from wp-config.php?

No. upload_max_filesize and post_max_size are PHP_INI_PERDIR settings, which PHP only accepts from php.ini, .htaccess, httpd.conf or .user.ini. An ini_set() line in wp-config.php runs without an error and changes nothing. wp-config.php can raise WordPress's memory limit, but memory is not what caps the file size.

Why do I still get 413 Request Entity Too Large after raising the PHP limits?

Something in front of PHP is rejecting the request. On Nginx it is client_max_body_size, which defaults to 1m and returns a 413 error when exceeded. Raise it in the server block and reload Nginx. If your site runs through Cloudflare, its plan limit on upload size can also stop the request before it reaches your server.

Does post_max_size need to be larger than upload_max_filesize?

It should be at least as large, and slightly larger is safer. The file is sent inside a POST request together with other form data, so the whole request counts against post_max_size. WordPress uses the smaller of the two values as its upload limit, so raising only upload_max_filesize leaves the limit where it was.