Tutorials

How to increase the maximum upload file size in WordPress

This tutorial contains affiliate links. If you sign up through them, I may earn a commission at no extra cost to you.

If you’ve tried to upload a long video, a large photo or maybe a PDF to WordPress, you’ve probably seen this:

my-video.mp4 exceeds the maximum upload size for this site.

Annoying, isn’t it? As tempting as it might be to curse Matt Mullenweg when it happens, the limit isn’t set by WordPress. It comes from your server’s PHP configuration, so the fix is in your hosting rather than in a WordPress setting. Here’s how to check your current limit, how to raise it, and what to do when you can’t.

If WordPress says “Sorry, you are not allowed to upload this file type” instead, the problem is the file type, not its size. I cover that in how to upload SVGs in WordPress.

Check your current limit

Go to “Media” → “Add Media File”. Below the upload area, WordPress shows the limit: “Maximum upload file size: 2 MB.”

For the details, go to “Tools” → “Site Health” → “Info” and expand “Media Handling”. It lists the maximum size of post data, the maximum size of an uploaded file, and the effective limit WordPress ends up with.

What actually sets the limit

WordPress uses the smaller of two PHP settings:

  • upload_max_filesize is the largest single file PHP accepts. PHP’s default is 2 MB.
  • post_max_size is the largest request PHP accepts in total. The file travels inside the request, so this needs to be at least as large as upload_max_filesize.

There can also be a limit in the web server itself. Nginx has a setting called client_max_body_size, which defaults to 1 MB. If it’s lower than the PHP limits, the upload fails before PHP ever sees it, and you get a vague HTTP error in WordPress (or “413 Request Entity Too Large” if you look at the response).

The easy way: ask your host

Most of the time, this is a two-minute job for your host. Many hosting control panels let you change PHP settings yourself, like the MultiPHP INI Editor in cPanel or PHP Settings in Plesk. If yours doesn’t, send a message to support:

Could you raise upload_max_filesize and post_max_size to 256M for my site?

Managed WordPress hosts usually have generous limits from the start. On WordPress.com, where this site is hosted, the limit depends on your plan. Mine shows 2 GB. For files larger than that, you’re probably better off hosting them somewhere else, like a video service or cloud storage. WordPress is good for many things, but a Dropbox replacement it is not.

Do it yourself

If you have file access and your host lets you override PHP settings, create a file called .user.ini in your site’s root folder (the same folder as wp-config.php):

upload_max_filesize = 256M
post_max_size = 256M

This works on most hosts today, since they run PHP through PHP-FPM or another FastCGI setup. PHP caches .user.ini files, so give it up to five minutes before you check. If you have access to the full php.ini file, the same two lines go there instead.

Older Apache setups that run PHP as a module use .htaccess instead:

php_value upload_max_filesize 256M
php_value post_max_size 256M

Be careful with this one. On a server that doesn’t run PHP as an Apache module, these lines cause a 500 error and take down the whole site. If that happens, remove them and use .user.ini instead. Again, ask your host if you’re unsure. This is one of the most common support requests they get and they’ll likely help you quickly and without fuss.

What doesn’t work

Search for this problem and you’ll find plenty of articles telling you to add something like this to wp-config.php or your theme’s functions.php:

@ini_set( 'upload_max_filesize', '256M' );
@ini_set( 'post_max_size', '256M' );

It does nothing. PHP only lets you change these two settings in configuration files, not from code while it’s running. And even if it did, the upload has already been accepted or rejected by the time WordPress loads. The @ in front is there to hide the error that tells you so.

A few other dead ends:

  • WP_MEMORY_LIMIT in wp-config.php controls how much memory WordPress can use. It has nothing to do with upload size.
  • The upload_size_limit filter changes the number WordPress shows and checks against, but it can’t raise the server’s limit. Set it higher, and uploads just fail at a later step instead.
  • Plugins that promise to increase the upload size can’t go above your server’s limit either. The ones that seem to work either write the .user.ini or .htaccess lines above for you, or only change the number WordPress displays.

Multisite

On a multisite network, there’s one more limit. Go to “Network Admin” → “Settings” and find “Max upload file size”. It’s set in KB and defaults to 1,500 KB. Sites on the network get whichever is lower, this setting or the PHP limit.

Check that it worked

Reload “Media” → “Add Media File” and look at the limit again. If it hasn’t changed, Site Health shows which of the two PHP settings is still low. Remember the five-minute cache for .user.ini, and keep in mind that some hosts don’t allow overrides at all. Then you’re back to asking support.

When the file is just too big

Sometimes raising the limit isn’t the right fix:

  • Images: WordPress scales down images larger than 2560 pixels anyway, so there’s rarely a reason to upload a 40 MB original. Export a smaller version first.
  • Videos: Host them on YouTube or a video service like VideoPress, and embed them. Your server and your visitors will both be happier.
  • One-off large files: Upload the file to your server with SFTP, then import it into the media library with WP-CLI. This skips the upload limit entirely:
wp media import ~/uploads/large-file.mp4

Published November 23, 2026

Modified December 1, 2026