How to increase the maximum upload file size in WordPress?
Table of Contents
When creating or updating your WordPress site, you often have to upload files like themes, plugins, images, or videos. However, sometimes the upload of large files may be obstructed by the preset upload file size limit. Therefore, you may need to increase the maximum upload file size in WordPress to proceed with your work.
In this tutorial, we will reveal what is the WordPress maximum file upload size, why you should increase it, and how to check its current value. Furthermore, we will show you how to increase the upload file size in WordPress.
Most hosting providers configure this PHP variable on a server level, and WordPress fetches this setup. For example, at SiteGround, the upload_max_size is predefined at 256MB and can be increased further by a client’s request only for Cloud servers.
There are several options in WordPress to increase the upload size; however, none of them can overwrite the server’s preset value. Still, if your WordPress uses an upload size value lower than the server limit, you may have some room to expand.
How do I increase the maximum upload file size in WordPress?
There are a few different ways to increase the max upload size in WordPress and most of them involve editing your files. But don’t worry – we’ve got you covered in this section, where we will walk you through them step-by-step.
Update your .htaccess file
You can have your WordPress increase the max upload size by editing your site’s .htaccess file. This can be done from your hosting control panel, and for SiteGround clients, that is Site Tools. When logged in there, head for the File Manager and find the .htaccess in your site’s root directory, then paste the snippet you see below:
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
Note, that for SiteGround clients this snippet will work only if your site uses the Ultrafast PHP setup. On a Standard PHP setup, .htaccess does not support “php_value” and adding it will cause an Internal Server Error 500. Thus, you may choose one of the following options instead if you are using the Standard PHP setup.
Create or Edit an Existing ‘php.ini’ or ‘.user.ini’ file
To increase the maximum upload size in WordPress, you can create or edit an existing php.ini/.user.ini file. The “.ini” files hold configuration information for PHP and they are used for applications like WordPress that run on PHP. These PHP initialization files are in a predefined format with a basic structure, written in plain text.
The standard initialization file is the php.ini; however, many new WordPress plugins and themes use a .user.ini file instead. There is a basic difference between the two – a php.ini works recursively for all directories, while the .user.ini applies PHP settings only to the directory it is placed in. This way, you can use specific PHP directives for separate directories.
If none of the “.ini” files exists within your root directory, then your site will use the default PHP settings defined on the server.
To edit or create a “.ini” file, go to your Site Tools > Site > File Manager (or the file manager provided by your WordPress hosting) and load the root folder for your site. When in there, click on the New File button and type php.ini or .user.ini to set a name for the file.
When the file is created, use the Edit button to load the text editor and paste in it the code you see below, then click Save.
upload_max_filesize = 25M
post_max_size = 13M
memory_limit = 15M
Add Code to Your WordPress Theme functions.php File
Another option is to edit the functions.php file of your WordPress theme. You can do this via FTP or directly from your hosting’s File Manager. The functions.php file should be placed in ~/wp-content/themes/yourtheme/functions.php. Edit the file and paste the following code snippet at the bottom of it.
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );
Edit your wp-config.php File
Many online tutorials advise that you can increase the maximum upload file size by adding the following directives in your wp-config.php.
@ini_set( 'upload_max_size' , '20M' );
@ini_set( 'post_max_size', '13M');
@ini_set( 'memory_limit', '15M' );
Unfortunately, this method is not viable anymore as per the recent PHP configuration mode changes. This document outlines that ini_set() function directives are associated with different PHP changeable modes which require their setup in specific configuration files.
The upload_max_size and post_max_size variables are associated with the PHP_INI_PERDIR changeable mode and are to be set in either php.ini, .htaccess, httpd.conf, or .user.ini.
Therefore, we recommend you choose one of the other approaches, we suggested, to increase the file upload size for your WordPress site.
Use a WordPress Plugin to Increase Upload File Size
Another alternative is to increase the max upload size in WordPress with a plugin. As an example, we will use the Big File Uploads plugin. It shows you the default upload size setup on your server and allows you to increase it if there is more room for doing so.
As you can see in the screenshot, the plugin can bypass the server’s upload size limit by seamlessly uploading files in multiple smaller chunks. It also allows you to customize the upload size per user role.
Increase Maximum Upload File Size in WordPress Multisite
When you are working with a WordPress Multisite, you should note that it has a default limit of 1500 KB (~1,5MB) for the upload file size. You can increase that number to your default server value from Network > Network Settings > Settings.
Additionally, a Multisite setup allows you to set a particular upload size value for each site under your network.
Contact Your Hosting Provider
If you have already tried all the options explained above and your WordPress max upload size is not increasing, you may need to contact your hosting provider for help. SiteGround clients can reach us any time, and we can help you set the upload size or increase it on a server level if that is appropriate for your hosting plan.
Why Increase the Maximum File Upload Size in WordPress?
The maximum file upload size in WordPress is set at a certain limit to prevent server timeouts since uploading large files takes lots of server resources.
Sometimes, the limit is set so low that you would not be able to even upload a large image file. In cases like these, you will see an error stating that this file “exceeds the maximum upload size.”
That is the moment you realize that you may need to change this setting to ensure your files will be uploaded.
Let’s say that you are trying to upload a new theme file on your site, but if its size surpasses the default limit, the upload will fail. If your site has this PHP variable set at a low value, the upload will result in the above-mentioned error. Therefore, you would need to increase the max upload size in WordPress to solve the issue.
Frequently updating your site’s content also may make you wonder how to increase your WordPress upload size. For instance, if you are selling digital content (like ebooks or photos), you would want a reasonable value for this variable.
A WordPress increase in the file upload size is mostly necessary when you want to be able to upload large files. Still, you wouldn’t want that PHP variable to be set too high to ensure your site’s efficiency and security. Having a reasonable upload size may protect you from hackers, trying to upload colossal size files and distorting your site’s functionality.
How to Check Your Maximum Upload File Size Limit in WordPress?
There are several ways to check your WordPress maximum file upload size limit, and we will discuss them below:
- The first place you can see the maximum upload size limit is in your WordPress Dashboard. Navigate to Media Library > Add New, and you will see the Maximum upload file size value, as in the screenshot below:
- Another option to find the maximum upload size for your WordPress is through the Site Health tool. This feature was introduced in WordPress version 5.2, and it provides valuable insight into your site’s health. The tool helps you monitor your site and can notify you if anything needs improvement. You can find it in your WordPress Admin Dashboard under the Tools section. Go for Site Health, and under the Info tab, find the Media Handling or Server section. Both sections contain information about the maximum upload size for your site.
- SiteGround clients can also find out what the default upload size value on the server is from their Site Tools. When you log in there, navigate to Devs > PHP Manager from the left sidebar and go to the PHP Variables section. There you can use the filter to find out the size at which the upload_max_filesize variable is set.
Note that this variable is set on a server level and it can not be increased further from Site Tools. That applies to all shared hosting accounts; however, Cloud account owners can request an increase from our Support Team.