How to Change the Max Upload Size in WordPress
WordPress comes with a built-in media uploader, to make your work a little easier. However, this PHP-based tool comes with a maximum upload size limit. If you need to add a large file to your site, you may be hit with an error message.
Fortunately, there are ways of increasing the maximum file upload size and avoiding that problem. Some of these methods involve updating your website’s files. Others require you to install and activate a dedicated plugin.
In this article, we’ll look at how to check your maximum file upload size. We’ll then walk through the ways to increase this limit. Let’s get started!
How to Check the Maximum File Upload Size Limit
By default, WordPress limits uploads to somewhere between 2MB and 150MB, depending on your hosting provider’s configuration. To find out what the limit is on your site, you can navigate to Media > Add New:
At the bottom of the page, you can see the maximum file upload size. This limit is generally big enough for the average WordPress user. However, if you need to upload larger files, you can increase it.
Therefore, this is not a step every website owner will need to consider. However, if you run a website that relies on video uploads (for example) this could become necessary.
Increasing the WordPress Maximum File Upload Size (6 Methods)
There are many methods you can use to increase the maximum file upload size in WordPress. Your main six options are:
- Update the .htaccess file.
- Edit the functions.php file.
- Edit or create a php.ini file.
- Use multisite settings.
- Define the size parameter in your wp-config.php file.
- Use a plugin.
Below, we’ll show how each of these techniques work. Keep in mind that some of these methods may not work on your specific website. If you run into any trouble, you might need to contact your hosting provider for further assistance.
1. Update the .htaccess File
The .htaccess file is the configuration file for Apache servers. If your web host uses that kind of server, you might be able to access and update this file in order to increase upload size limits. To do this, you’ll need to add some code to the file. However, remember to first create a backup of your website.
Then you’ll need to use a File Transfer Protocol (FTP) client to connect to your website’s server. In the client’s window, navigate to the folder named after your website. The root directory of your website will open, and the .htaccess file should be at the top:
Right-click on the file and select View/Edit. This opens the file in your default text editor, such as Notepad. Once the file is open, add the following code:
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
The numbers in the code can be changed to meet your upload needs. They are all in megabytes, while the times are in seconds.
After adding the code, save your changes. If you receive an Internal Server Error when trying to implement this code, it means that this method cannot be used with your hosting provider.
2. Edit the functions.php File
If you are unable to use the .htaccess file, or are uncomfortable adding code to it, you can adjust your site’s upload limit with the functions.php file instead. This file is part of your theme, and can be accessed in your dashboard by navigating to Appearance > Theme Editor:
In the list of files on the right, choose functions.php. Add the following code to the bottom of the file:
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );
The upload size should be adjusted to meet your needs, and is listed in megabytes. Then save the changes to the file.
3. Edit or Create a php.ini File
The php.ini file is one of the most important files on your server, because it controls how the server is set up. As such, you might not have access to this file, since it is restricted by many web hosts. If you do have access, you can use it to adjust the maximum upload size in WordPress.
To access this file, you will need to use an FTP client or the File Manager in your host’s cPanel. If you can’t find this file, you might need to create one. In a text editor, open a new document and paste in the following code:
upload_max_filesize = 25M post_max_size = 13M memory_limit = 15M
Save the file as “php.ini”, and then upload it to your website’s root directory using an FTP client. If the file is visible, you will need to add this same code to the file and then save it.
If your website runs on shared hosting, this method might not be the best option, as you’ll be altering a core server file. Some shared hosts allow this modification, but you’ll need to provide the suPHP directive in the .htaccess file.
To do this, open your .htaccess file and add the following code:
<IfModule mod_suphp.c> suPHP_ConfigPath /home/yourusername/public_html </IfModule>
This code should be added close to the top of the file. Then it can be saved and re-uploaded.
4. Use Multisite Settings
If your website is part of a multisite installation, adjusting the maximum file upload size is much easier. However, keep in mind that the amount you can increase the limit will be dependent on your server’s settings.
To increase your maximum upload size, navigate to My Sites > Network Admin > Settings:
Scroll down to the Max upload file size and change the figure to meet your needs:
This figure is represented in kilobytes. Once you’ve made your edits, click on Save Changes and your limit will be updated.
5. Define the Size Parameter in the wp-config.php File
If none of the other methods so far have worked for you, you can consider defining the size parameters in your wp-config.php file. To access this file, you’ll need to use an FTP client and navigate to the root directory of your website:
Right-click on the file and select View/Edit. When the file opens in a text editor, you’ll need to add the following code:
@ini_set( 'upload_max_size' , '20M' ); @ini_set( 'post_max_size', '13M'); @ini_set( 'memory_limit', '15M' );
Adjust the numbers in the code to match your upload needs, and save your changes.
6. Use a Plugin
If you are nervous about updating your website’s files, or encounter issues with your server, a plugin might be the best solution. One of the plugins you can use is Increase Maximum Upload File Size.
Start by installing and activating the plugin. After that, navigate to Settings > Increase Max Upload Filesize.
Under Choose Maximum File Size, select the limit you require from the list. Click on Save Changes, and your upload file size will be increased.
Build Customized Digital Experiences on WP Engine
If you need to upload large files to your website, you can increase your WordPress upload limit. As you can see, there are many ways to do this. Of course, what options are available to you will depend partly on your hosting provider.