Header Ads

How to fix error Exceeds The 'Upload Max File Size' in WordPress

If you try to upload files to your Wordpress websites and get an error "Uploaded file exceeds the upload_max_filesize directive in php.ini", you can easily fix this error by increasing upload_max_filesize setting for Wordpress. Follow one of three methods below (1- Change setting in PHP.INI; 2-Change setting in .HTACCESS; and 3- Change setting in FUNCTIONS.PHP). It will work well.
How to fix error Exceeds The 'Upload Max File Size' in WordPress
By default, the limit of max file size for uploading in WordPress is 2MB (WordPress version 3.7.1). It is quite small in some cases (most videos, archives and high-quality images are much bigger than 2MB). And in those case, you will get the error "he uploaded file exceeds the upload_max_filesize directive in php.ini" . And here are how to fix the error.
How to fix error Exceeds The 'Upload Max File Size' in WordPress

How to fix error Exceeds The 'Upload Max File Size' in WordPress

Depend on how you can control the WordPress source code and what you are more familiar with, you can choose one of three below methods. In most cases, I suggest you choose method 1 - Increase the max upload file size by changing the setting on PHP.INI, because it will affect all your websites that hosting on the same server.
Note: Make sure to backup carefully before you change anything!

Method 1: Increase the max upload file size by PHP.INI

This is the most effective and common method to fix the error exceeds the upload max file size in WordPress.
Requirement: You have access to the file PHP.INI (usually locate on /etc/php.ini). If you host your websites on a VPS or dedicated server, you should have the access, but if you host your websites on a shared hosting, you will not have the access! => In this case you have to use method 2 or method 3.
Follow below steps:
1. Open PHP.INI file (via a FTP client such as Filezilla, CuteFTP...)
2. Find the keys:
memory_limit 16M
post_max_size 2M
upload_max_filesize 2M
max_execution_time 100
Then change to:
memory_limit 128M
post_max_size 256M
upload_max_filesize 256M
max_execution_time 600
3. Save the php.ini file and upload it back.
4. Reset your server (or reset HTTPD service)
Done!
Notes: You can customize the above with your desired values 
And now, you can enjoy uploading your big files to websites
Method 1: Increase the max upload file size by PHP.INI

Method 2: Increase the max upload file size by .HTACCESS

This is the easier way to fix the problem and mostly used if your websites host on a shared hosting. All you have to do is to add or overwrite those configurations into your .HTACCESS file (.HTACCESS file is located on root folder of each website):
#Change upload limits
php_value memory_limit 128M
php_value post_max_size 256M
php_value upload_max_filesize 256M
php_value max_execution_time 600
#Change upload limits end
Notes: You can change 256M with your desired max file size

Method 3: Increase the max upload file size by FUNCTIONS.PHP

- Open the file Functions.php located on your current Wordpress Themes (/wp-content/themes/...)
- Add below code into the file:
@ini_set( 'upload_max_size' , '256M' );
@ini_set( 'post_max_size', '256M');
@ini_set( 'max_execution_time', '600' );
Enjoy!

No comments:

EasyTipz. Powered by Blogger.