Most hosting providers set limits to the PHP memory for running applications. The uploaded file exceeds the upload_max_filesize directive in php.ini is an error that occurs on your WordPress website when you upload a file that exceeds the limitations set by your web server.
How to Fix the upload_max_filesize Error
As you might have guessed, the solution involves increasing the default limit of upload_max_filesize. Let’s look closely at it and see what steps we can take to fix this error.
Method 1. Editing the .htaccess File
- Login to CPanel and navigate to File Manager under the Files section.
- Locate the .htaccess file and right-click to Edit.
- Add the following line at the bottom of the file and Save the changes.
php_value upload_max_filesize 256M
Method 2. Editing the wp-config.php File
Another way to fix the uploaded file exceeding the upload_max_filesize directive in php.ini error is by tweaking the wp-config.php file in your root directory.
For that, log in to the CPanel and access public_html to edit the wp_config. php file. Add the following line before the “That’s all, stop editing! Happy publishing” line:
@ini_set('upload_max_size' , '256M' );
Once you add the code, Save the file, refresh your web browser, and try uploading again!
Method 3. Updating php.ini to Fix the upload_max_filesize Error
If you wish, you can always modify your PHP settings through the PHP Configuration tool on CPanel.
If you’re using VPS or a different platform, you can try updating php.ini to fix the error. Here’s what you need to do:
- Navigate to your php.ini file and edit it. If you can’t find it, ask for assistance from your hosting providers.
- Locate the upload_max_filesize and increase it by changing its number. You can also boost a few other limitations, as shown below:
upload_max_filesize = 256M post_max_size = 256M memory_limit = 512M max_execution_time = 180
Save the file, and that’s it. The error should no longer occur.