Having trouble uploading files to your WordPress website? Learn how to increase the upload size limit On your Website in this article.
This error is generated when the media file we are trying to upload is larger than the limit set on your website. This can be caused either by the WordPress site or the restrictions at the host. Many hosts keep their upload limit too low, which in turn causes this problem. This is not always a case with WordPress. Sometimes, the WordPress maximum upload size is a server-level setting which means this can’t be resolved from within WordPress. This is a security measure to prevent users from flooding the site with huge capacity videos, etc.
Before proceeding on how to increase upload size for any media in WordPress, first check the maximum upload limit. For this, go to ‘media’ and then to ‘add new’ page and there you will find this maximum file upload size limit for your WordPress site.
If you run a mult-isite installation, you may be able to control upload limit for your site. But this doesn't let you avoid the server level settings. You can't exceed the limit set by the server. You can extend your limit under the limit of the server. This can be done in two main steps:
Open settings on network admin from your WordPress dashboard.
Now go down and double check the “max upload file size” settings.
Now you can increase that from the default value to under 1.5 MB and save changes. Its default value is 1500 KB.
If you are a non-techy and prefer getting this problem solved from experts, you should surely contact your host. Many hosting companies provide chat support that helps in faster communication and troubleshooting. Uploading limit is a complex job for non-techy people but its a job of minutes for the technical team. So, itis always a better option to reach out for help to your host. This can save you time and effort.
There is a need to make a change in the server settings that affect the handling of uploads by WordPress. In some cases, the necessary setting changes to be made are less than the numerous changes made. There are three main things needed to be made changes in. they are post_max_size, upload_max_filesize, memory_limit.
It sets the maximum size of the post. It also has to effect on file upload.
To upload a larger file, their values must be larger than upload_max_filesize.
Memory_limit also affects file uploading. In general words, this should be larger than post_max_size.
If the host you are running on uses cPanel, then you can make modifications in it by using the UI. go to ‘software’ and click on “Select PHP Version”
Now select “switch to PHP options”.
Here you can click on an individual property to change its value. Now click on ‘save’.
Your server setup is governed by php.ini files by default. To edit your php.ini files, first, you need to login to your site via FTP or SSH. now go to your site’s root directory and open or else create the php.ini file.
If the file is already present, make the necessary changes in the three settings. If you just created the file, and those settings aren't found, paste this code and change values as per your requirement.
upload_max_filesize = 12M
post_max_size = 13M
memory_limit = 15M
In case of some hosts, they need you to add PHP directive in your .htaccess file for these php.ini file settings to work. You can do this by editing your .htcaccess file, which is located at the root of your site and add this code at top of the file:
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/yourusername/public_html
</IfModule>
If you use cPanel, the php.ini file can sometimes be modified via MultiPHP INI Editor tool. Go to ‘software’ and click on “MULTIPHP INI Editor”.
Now select your home directory from the drop-down menu. This home directory is the domain root.
Now make a change in the value of upload_max_filesize. Make it larger than what it is by default.
In case if your host has global settings locked, login to your site via FTP or SSh. now go to your site’s root directory and open .user.ini file. Paste the following code in there. If there isn't this file, create one and then paste the code:
You can also modify server behaviour by making changes in settings of a special hidden file in .htaccess. You can make changes to a directory specific level.
To begin with, login to your site via FTP or SSH. now scan your root directory for the .htaccess file.
When you find that, you can edit that file and add the necessary code to increase upload limit. Add this code in that:
php_value upload_max_filesize 12M
php_value post_max_size 13M
php_value memory_limit 15M
There is a probability that you may get a message, “internal server error”. It means that your server is running PHP in CGI mode. This doesn't give you access to use above commands in the .htaccess file. Now you need to use another method.
Login to your sites via FTP or SSH.
Scan for the wp-config.php file which may be present in the root of your site.
Now in the wp-congig.php file, add the following code:
@ini_set( 'upload_max_size' , '12M' );
@ini_set( 'post_max_size', '13M');
@ini_set( 'memory_limit', '15M' );
You can increase the upload size by just adding this code in the theme’s functions.php file:
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );
4. Utilize the WordPress upload_size_limit Filter:
In WordPress 2.5, a new filter was introduced. It was upload_size_filter. It helps in increasing the upload file size. An example code of that was given by Grew Jaynes:
/** Filter the upload size limit for non-administrators.
* @param string $size Upload size limit (in bytes).
* @return int (maybe) Filtered size limit.
*/
function filter_site_upload_size_limit( $size ) {
// Set the upload size limit to 60 MB for users lacking the 'manage_options' capability.
if ( ! current_user_can( 'manage_options' ) ) {
// 60 MB.
$size = 60 * 1024 * 1024;
}
return $size;
}
add_filter( 'upload_size_limit', 'filter_site_upload_size_limit', 20 );
There may be a probability of confusion. The post_max_size set in child directory overwrites the same directive in parent directory too. Thus, this leads to confusion.
If you are facing trouble in getting your limits raised through your host, you can upload your large files via FTP or SFTP. now you can use the free Add From Server Plugin. This is an ideal process for numerous large files.
Some WordPress hosting providers have a built-in feature that allows you to change the file size limit. You can process it by following these steps:
Over the bar on top, go to ‘servers’. Choose your desired server.
Open ‘settings and packages’ from the left panel
You will find an “upload size” under the basic settings tab and change it according to your requirement.
WordPress has a plugin for every task you don't want to do for yourself.
Over the dashboard of your WordPress, go to plugins.
Select “add new” and search for “increase upload max filesize plugin” from the top right corner
Install it and activate it.
Now go to settings of this plugin.
In upload size, enter new size as per your requirements.