The uploaded file exceeds the upload_max_filesize directive in php.ini
So, you’ve been working on your WordPress website and are now receiving an error: the uploaded file exceeds the upload_max_filesize directive in php.ini. when attempting to add new media. Don’t worry, this can happen to any type of website, large or small.
The reason for this is simple – Your default server settings have an uploadable file size limit. The only thing left for you to do now is jump in and change that default setting to allow you to upload larger files. Follow these next few simple steps to make the change:
1. Edit the .htaccess file
The easiest way to fix the uploaded file exceeds the upload_max_filesize directive in php.ini. error is increasing your PHP resource limits with the .htaccess file. You can access this .htaccess file through your file manager or through an FTP client. The .htaccess file can be found inside the public_html directory. Once you find it, either edit the file in the file in the file manager or download the file and open with Notepad.
Now locate the .htaccess file withing the file manager.
Simply add this line of code to the bottom of your .htaccess file to initiate the changes:
php_value upload_max_filesize 256M
Now save the changes. If you downloaded the file, save the changes and upload your file back into the public_html directory where your found it.
Please note: You can set the PHP limits to any preferred values if your server supports it. If you aren’t uploading unusually large files, your best bet is to increase the php_value upload_max_filesize to 256M.
Now check to make sure the changes are initialized. Upload the media file that was once too large to upload.
2. Edit the wp-config.php file
What makes the Wp-config.php so important is that it contains the base configuration details for your WordPress installation. This can be found in the root of your file directory.
First you need to to edit the memory limit and upload limit. Find the line:
Now increase the memory limit to 128M.
3. Edit PHP variable options
If none of the options above were effective, the problem is likely within your server settings. If you are facing php upload limit issues and the error reads: (…. exceeds the maximum upload size for this site), you can fix them at your end as follows:
- Login to your cPanel account
- Find and click on Select PHP version
- Select Switch to PHP options
- You can see several PHP variable options listed. Search for “upload_max_filesize” and “post_max_size” option and increase the value to a higher one, for example 2M to be increased to 16M and so on.
- Ensure that the changes are saved.
Contact your hosting provider if you are still experiencing issues.