← Tous les articles

“The uploaded file exceeds the upload_max_filesize directive”: what to do

Cannot upload a video or PDF to the media library? The limit comes from PHP and can be changed in three places depending on your host.

“The uploaded file exceeds the upload_max_filesize directive”: what to do

Key points

  • The upload limit is set by PHP, not WordPress.
  • Raise upload_max_filesize and post_max_size together.
  • For very large files, uploading directly to the server is more reliable.

The media library says “Maximum upload file size: 2 MB” and rejects your file. WordPress is only passing on the server’s PHP settings. Here is how to change them, and when not to.

Two settings, changed together

upload_max_filesize caps each file; post_max_size caps the whole request and must be larger. Raising only the first changes nothing.

upload_max_filesize = 64M
post_max_size = 72M
max_execution_time = 120

Where to put them

  • Your host’s panel (cPanel “Select PHP Version”, Plesk): the safest option, use it first.
  • A .user.ini file in the site root with the lines above, on PHP-FPM servers. It can take a few minutes to apply.
  • .htaccess with php_value upload_max_filesize 64M, only when PHP runs as an Apache module; otherwise it causes a 500 error.

Check it took effect

Tools → Site Health → Info → Server shows the values actually applied. If they did not change, your host enforces a cap that only their support can lift.

Should that file be uploaded at all?

A 300 MB video in the media library bloats backups and bandwidth. On our projects, videos go to a dedicated service and heavy PDFs are compressed first. For a one-off file, upload it over SFTP and import it with wp media import.

FAQ

The setting changes nothing. Why?

Either post_max_size is still smaller, or the host blocks the change. Site Health will tell you which.

Is there a WordPress-side limit?

On multisite, yes: Network Settings → Max upload file size.

Facing this on your site? We diagnose and fix it without putting your content at risk.

Partager LinkedIn Facebook X WhatsApp
</>

webtestudio

Agence web : sites WordPress sur mesure, thèmes premium et logiciels SaaS.

Parler de votre projet →