While maintaining a WordPress site, you need to upload images, themes and plugins through admin dashboard. However, uploading large file size will put pressure on your hosting server in terms of using resources. Due to this fact, many hosting companies, especially shared hosting plans, fix the maximum file upload size in a WordPress installation. If you are stuck and not able to upload the file, here is how to change file upload size in WordPress site.
Note: Uploading files through FTP is controlled by the quota you allocate while creating the account. Likewise uploading through File Manager generally does not have any limitation. In this article, we will discuss the file upload size from admin dashboard which has no impact for uploading files through FTP or File Manager.
Checking Default File Upload Size
You can easily check the current limit set on your installation from the admin panel. Go to “Media > Add New” section where you can see a notification below the file upload box mentioning the limit. As you can see in the below screenshot, the maximum file upload size is set as 8 MB.
Any file you try to upload more than the specified size here will result in file upload error. If you want to check the limit from the Gutenberg editor, add an image block and go to “Media Library” from the block options. Now, go to “Upload files” tab and there you can see the limit mentioned below the “Select Files” box.
There are also few other methods you can use to check the limit. For example, you can go to “Tools > Site Health” section and find the “Server” status under “Info” section. This section will show all server configurations including your current file upload limit.
Similarly, plugins like WooCommerce will show you the system status where you can find all server details.
Why to Increase File Upload Size in WordPress?
There are many reasons you may be interested in increasing the file upload size limit.
- Some themes come with bundled plugins and the size can easily exceed the limit set on your size.
- You want to run a photography or stock image website and need to upload the original photos from your digital camera or smartphone.
- You do not have access to FTP and primarily rely on uploading files through media library or post editor in admin panel.
- Selling large files through online store.
On other hand, you may have a large limit like 128MB and want to reduce the upload limit. For example, your theme or plugin may offer a feature for users to upload files through comments or membership form. In this case, you must restrict the limit to few MBs to avoid users trying to upload big files and crash your server.
How to Change File Upload Size in WordPress?
Here we will explain various methods to change the file upload size. However, the first thing you need is to consult with your hosting company whether you are allowed to increase the limit. If you have cloud, VPS, managed or dedicated hosting plans, most probably you can modify the limit yourself. For shared hosting, make sure to check allow the limit from the documentation or from the hosting support.
Parameters to Consider
Since large file upload needs the script to run for longer time, simply increasing the allowed size may not work in most situations. There are multiple PHP parameters you need to increase in the server configuration to get the desired result.
- upload_max_filesize – maximum file size you try to upload.
- post_max_size – this is the maximum size of the allowed POST data and should be greater than the upload_max_filesize.
- memory_limit – maximum allowed memory limit should be greater than post_max_size.
- max_execution_time – this is the time limit allowed by the server for a script to run. It is defined in seconds and the server will terminate any PHP scripts that try to run beyond the set value.
- max_input_time – maximum allowed time for a script to parse input data. Generally, max_execution_time is used for this value.
As you can see, the parameters need to be defined with proper values so that the file upload will work. For example, if you want to increase the file upload size to 64MB, below are the parameters you should change.
upload_max_filesize 64M post_max_size 128M memory_limit 256M max_execution_time 300 max_input_time 300
M indicates MB in size and you do not need to mention the seconds (300 indicates 300 seconds by default). You can check the official PHP documentation to learn more about these parameters.
1. Changing from cPanel or Custom Hosting Panel
- Login to your hosting account and navigate to cPanel section.
- Use the search box and type “php” to find MultiPHP INI Editor app.
- Click on the app to open where you can find “Basic Mode” and Editor Mode”.
- Under “Basic Mode” select the “Home Directory” or correct installation path to view all PHP directives available to configure your site.
- Change the value of “upload_max_filesize” setting to your desired value and change all other related parameters accordingly.
- Click “Apply” button to save your changes.
This is the easy way, though you can go to “Editor Mode” and edit or add the required directive. If you are using custom hosting panel like SiteGround Site Tool, then the process is similar with the change in interface.
2. Change php.ini File
In case if you are not able to use the hosting account, next option is to manually add the directives in your php.ini file. This is a server configuration file where you can add the details to increase the file upload size. Go to the root of your WordPress installation using FTP or File Manager and check whether you can find php.ini file. If you do not find the file, simply create a new empty file with the name as php.ini. After that add the following code in the file and save your changes.
upload_max_filesize = 64M post_max_size = 128M memory_limit = 256M max_execution_time = 300 max_input_time = 300
3. Add Directive in .htaccess File
The next option is to add the following codes in your .htaccess file. You can use plugins like Yoast SEO, Rank Math or similar plugins to edit the file. Alternatively, login to FTP and locate .htaccess file in the root of your WordPress installation.
php_value upload_max_filesize 64M php_value post_max_size 128M php_value memory_limit 256M php_value max_execution_time 300 php_value max_input_time 300
It should look something like below in your file:
Save your file and check that now you can upload 64 MB file size from dashboard.
4. Using a Plugin
WordPress has a plugin for everything and there are also many free plugins available for changing file upload size limit. Go to “Plugins > Add New” section and search for “file upload size”. Install and activate “Big File Uploads – Increase Maximum File Upload Size” plugin.
Go to “Settings > Big File Uploads” menu and the plugin allows you to change the followings:
- See the current size limit set by your hosting provider.
- Enter the new file upload size to increase or decrease the original value.
- Change the limit as per user role to have different limits for admin, editor, author and other users on your site. This is ideal if you want to restrict small size for subscribers and allow large size for administrators and editors.
- View the estimated maximum available space on your server.
- Do the analyze of your storage and view the statistics.
Checking the Size Back
Whatever the method you use, make sure to go to “Media > Add New” and confirm the new limit is set correctly. For example, we have set 500MB using the plugin option as explained above and the new limit shows correctly as shown in the below picture.