sfw/fix
upload_max_filesize medium

The Uploaded File Exceeds the upload_max_filesize Directive in php.ini

Your file is larger than PHP's upload_max_filesize, so the server rejects the upload before it completes.

What you see

The uploaded file exceeds the upload_max_filesize directive in php.ini.

What’s actually happening

You try to upload an image, video, theme, or plugin zip and it fails immediately or after a partial transfer. WordPress shows this exact line, and the Media Library or 'Add Theme/Plugin' screen displays your current limit (for example 'Maximum upload file size: 2 MB'). The default upload_max_filesize is 2M, which most modern photos and any video blow past. post_max_size also matters: it must be larger than upload_max_filesize, or the upload silently fails even when the file size looks fine.

Common causes

  • upload_max_filesize left at the PHP default of 2M (or a low host value like 8M).
  • post_max_size equal to or smaller than upload_max_filesize, capping the whole POST body.
  • A genuinely large file: high-res photos, a 4K video, or a big premium-theme zip.
  • Nginx in front of PHP with client_max_body_size too low (default 1M), rejecting the body before PHP sees it.
  • php.ini changes made in a file your handler ignores (e.g. .htaccess php_value lines under PHP-FPM or LiteSpeed).

How to fix it

  1. Raise both directives together in php.iniSet upload_max_filesize = 64M and post_max_size = 128M. Always keep post_max_size larger than upload_max_filesize, and set memory_limit at or above post_max_size. On cPanel use MultiPHP INI Editor.
  2. Use .htaccess only if mod_php is activeAdd php_value upload_max_filesize 64M and php_value post_max_size 128M to .htaccess. This works on Apache with mod_php but throws a 500 or is ignored on PHP-FPM/LiteSpeed/Nginx, so use the host's PHP panel there instead.
  3. Add to wp-config.php as a fallbackAdd @ini_set('upload_max_filesize', '64M'); and @ini_set('post_max_size', '128M'); near the top of wp-config.php. Note many hosts mark these PHP_INI_PERDIR so ini_set can't change them at runtime, in which case it does nothing and you must use php.ini.
  4. Raise the Nginx body limitOn Nginx stacks add client_max_body_size 128M; to the server or http block and reload Nginx, or you'll get '413 Request Entity Too Large' regardless of the PHP values. This is the one most people forget.
  5. Confirm the new limit, or sidestep itReload the Media Library and check the 'Maximum upload file size' line reflects your change. For large video, upload via SFTP into wp-content/uploads, or host it on YouTube/Vimeo and embed, instead of pushing it through the PHP uploader.

Stop it recurring

Set upload_max_filesize, post_max_size, and (on Nginx) client_max_body_size to comfortably exceed your largest expected upload, keeping post_max_size above upload_max_filesize.

Related errors