Quick answer
A file upload error in WordPress is usually caused by PHP file size limits. The solution is to increase the values of `upload_max_filesize`, `post_max_size` and `memory_limit` in `php.ini` or via `.htaccess`/`wp-config.php`. After the change, restart PHP and check the new limits in WordPress.
How to recognize the problem
- Message "The uploaded file exceeds the upload_max_filesize directive in php.ini"
- Upload reaches 100% but the image does not appear in the media library
- HTTP error when uploading larger files
- Cannot install a plugin or theme because the file is too large
- Images missing from the media library after upload
Most common causes
PHP limit `upload_max_filesize`
PHP by default often allows only 2 MB per file. If your file is larger, WordPress will show an error.
PHP limit `post_max_size`
This value must be greater than `upload_max_filesize` because it covers the entire POST request, including other data.
Insufficient `memory_limit`
Processing large images may require more memory. If the limit is low, the upload may fail even without a clear message.
Hosting-side restrictions
Some hosting providers do not allow changing PHP limits or restrict it. In that case you must contact support.
Security modules (mod_security)
Rarely, but it can block an upload if it considers the file suspicious. Then you need to contact the server administrator.
Step-by-step fix
- 1
Check current limits
Open
Tools > Site Health, then theInfotab and theServersection. Look for the values ofupload_max_filesize,post_max_sizeandmemory_limit. Write them down so you know how much to increase. - 2
Increase limits in `php.ini`
If you have access to the
php.inifile (via cPanel or FTP), make a copy of the file, then find the linesupload_max_filesize,post_max_sizeandmemory_limit. Change them to the desired values, for exampleupload_max_filesize = 64M,post_max_size = 128M,memory_limit = 256M. Save the file and restart PHP via the hosting control panel, if that option is available. If not, contact hosting support. - 3
Increase limits via `.htaccess`
If you cannot change
php.ini, make a copy of the.htaccessfile in the WordPress root, then add the lines:php_value upload_max_filesize 64M,php_value post_max_size 128M,php_value memory_limit 256M. This works only if the hosting allowsphp_valuedirectives, for example with mod_php. If the site shows a 500 error after the change, restore the file copy. Save and refresh the page. - 4
Increase the limit in `wp-config.php`
In
wp-config.php, before the comment/* That's all, stop editing! Happy publishing. */, adddefine('WP_MEMORY_LIMIT', '256M');. This increases the WordPress memory limit, but not the PHP upload limits. For a complete solution use the previous steps. - 5
Check whether the changes were applied
After the changes, open
Tools > Site Health > Infoagain and check whether the new values are shown. If not, the changes did not take effect (a PHP restart may be needed or the hosting does not allow the change). - 6
Clear cache and try again
Clear the browser cache and the cache of the caching plugin (e.g. WP Super Cache, W3 Total Cache). Then try uploading the file again. If it still fails, check whether the file is perhaps larger than the new limit.
- 7
Use FTP for large files
If you still have a problem, upload the file directly to the server via an FTP/SFTP client into the appropriate folder (e.g.
wp-content/uploads). Keep in mind that FTP upload does not go through WordPress validation and does not register the file automatically. Then add it to the media library using a plugin for importing files from the server or use it as an external file.
If nothing helps
If you changed php.ini, .htaccess and wp-config.php, but the limits do not change, the hosting probably has central restrictions. Contact hosting support and ask whether they can increase upload_max_filesize and post_max_size for your account. Mention that you use WordPress and state the desired values. In rare cases, the problem may also be in mod_security rules. Also, check whether the file is perhaps corrupted or too large for any upload (e.g. a 2 GB video). In that case, compress it or use an external storage service.
How to prevent it
- Regularly check PHP limits in `Tools > Site Health > Info`.
- Use image optimization plugins before uploading (e.g. Smush, Imagify).
- Limit the file size you allow users to upload (e.g. in a contact form).
- Follow hosting recommendations and upgrade the package if needed.
When to call a professional
If you do not have access to server files or the hosting does not allow changes, contact IT support. They can change the PHP configuration or contact the hosting on your behalf.
Website development · Fast, SEO-ready, multilingual websitesFAQ
What is the maximum upload limit in WordPress?
WordPress itself does not define a limit for media files; it depends on the PHP configuration. It is often 2 MB, but many hosting providers allow 64 MB or more. You can increase it if the hosting allows.
Can I increase the limit without access to `php.ini`?
You can try via `.htaccess` if the hosting allows `php_value` directives. Via `wp-config.php` you can only increase the WordPress memory limit (`WP_MEMORY_LIMIT`), not the upload limits. If it does not work, contact hosting support.
Why does my image upload but not show?
The upload may have been interrupted due to `memory_limit` or `post_max_size`. Check the limits and try again. Also, check the permissions of the `wp-content/uploads` folder.