Have you ever tried to upload a file to your WordPress site and faced an error message like “Maximum upload file size: 2MB.”
If you have, you are not alone. All WordPress sites have a limitation on the maximum file upload size. The default limitation is set at 2MB, which might work for pictures and documents but definitely not suitable for uploading audio or video files.
In today’s post, I will show you to increase the maximum file upload size in WordPress.
Before we begin, let’s get some basics right. We need to make three changes in PHP to increa
se the file upload size. These settings are –
- upload_max_filesize: It sets the maximum file upload size.
- post_max_size: It sets the maximum upload limit for POST requests.
- memory_limit: It handles memory allocation for PHP. This value should be the same or higher than the value of upload_max_filesize.
Now that you know which settings we will work with, let’s find out how to increase the maximum upload size.
Using the php.ini File
The php.ini file includes the PHP settings for your server. The file is usually located in the root directory of the server. The file might be hidden in the default view. So, enable the “Show hidden files” option and search for the file.
On some instances, you may find a file named “php5.ini.” This file serves the same purpose as the php.ini file.
Once you have found the file, open it by using a text editor. Search for any of the three PHP settings I mentioned earlier. If you find these settings, update their values according to your requirements. Alternatively, add the following lines to the file –
upload_max_filesize = 12M post_max_size = 13M memory_limit = 15M
Feel free to change the limits according to your requirement. Save the file and find out whether the upload limit is increased or not.
Using the .htaccess File
If the previous method didn’t work, you can try editing the .htaccess file. This file contains the settings and configurations for your server. You will find this file in the WordPress installation folder of your website.
Similar to the php.in file, the .htacess file might also be hidden by the hosting provider. In that case, enable the show hidden files option and locate the file.
Open the file with a text editor. Find out the PHP settings and update the values. In case the .htaccess file doesn’t have these settings defined, add the following lines to the file –
php_value upload_max_filesize 12M php_value post_max_size 13M php_value memory_limit 15M
Save the file and try uploading your file now. If the upload limit is still not increased, try the next method.
Using a Plugin
There are several WordPress plugins that enable you to increase the upload limit. Among these, I especially like the Increase Max Upload Filesize plugin because of its simple interface.
Once you install and activate the plugin on your WordPress site, you will notice a new menu item titled “Max File Size” in the dashboard. Clicking on that link will take you to a page like the following –
The page offers a dedicated field for defining the maximum upload file size you want to use. Keep in mind that you have to provide the value in bytes. That means you have to use “20480000” as the value if you want to set 20MB as the maximum file upload size.
Provide the maximum file size according to your requirements and click “submit.” This will increase the maximum file upload size. Go to Media > Add New and make sure the maximum file upload size is increased.
Modifying the WordPress Files
If none of the above works for you, you can try modifying the WordPress files. As this is not the recommended method, you should try this as the last resort. First of all, locate the wp-config.php file in the WordPress installation folder of your website.
Open the file with a text editor and locate the line that says the following –
/* That's all, stop editing! Happy blogging. */
Add the following code before that line –
@ini_set( 'upload_max_size', '12M' ); @ini_set( 'post_max_size', '13M'); @ini_set( 'memory_limit', '15M' );
Save the file and check out if you can upload large attachment files now. If the upload limit is still not increased, proceed to the next step.
Getting Help from the Hosting Provider
At this point, you have tried all the commonly available solutions to increase the maximum file upload size of your WordPress site. Since none of these worked for you, the next step is to ask help from your hosting provider.
Find out which support options your hosting provider offers and choose the convenient method. Let them know about the steps you have taken so far. They should be able to help you increase the maximum file upload size.
The default file upload limit of 2MB is no more practical for modern websites. This detailed tutorial introduced you to the best ways to increase the file upload size. Feel free to try these limits and enjoy larger file upload size.
So, which method worked for you? Let me know in the comments below.