Have you ever tried to upload a large media file to your site’s Media Library? Chances are you ended up getting an error message saying that the file exceeded the WordPress upload limit.
Fortunately, there are a number of ways you can go about increasing the default upload limit to accommodate files that exceed it. In this post, we’ll show you how you can increase your site’s upload limit to a larger maximum file size in four different ways. But before we begin, let’s take a look at what this error looks like and some scenarios in which you may find yourself needing to increase the maximum WordPress upload limit.
Let’s get started.
Getting error messages when you upload large files in #WordPress? Increase your upload limit with 4 easy methods.Click to tweet
When Might I Need to Increase the WordPress Upload Limit?
Your WordPress website’s maximum upload limit depends on your web hosting provider and hosting plan.
Generally, it’ll be somewhere between 2 MB and 150 MB. An easy way to find out your site’s upload limit is to navigate to Media > Add New from your site’s dashboard. The maximum upload file size (in MB) should be displayed right under the upload box.
Here’s a few reasons why you might want to consider increasing your default WordPress upload limit:
- You are running a media-intensive website full of high-quality images and videos.
- You’re installing a WordPress theme or plugin that has a large file size.
- You need to put up large, downloadable documents on your website.
If you’re on the higher end of that scale, it’s very likely that you won’t ever encounter any problems with the maximum upload size. However, if your hosting provider prohibits your maximum WordPress upload limit to only a few MB then you may want to increase it to be able to upload larger files.
How Can I Increase the WordPress Upload Limit to a Larger Maximum File Size?
There are a number of ways you can go about modifying your WordPress upload limit depending upon your server configuration. In this section, we’ll walk you through four different options for how to increase your site’s upload limit to a larger maximum file size. Keep in mind, however, that you might have to try out a few solutions before you land on one that works for you.
Since we’ll be modifying WordPress’ core files, we recommend that you make a full backup of your website before you begin.
Option 1: Edit the php.ini File
The php.ini file is the default configuration file for running PHP applications such as WordPress. It controls several variables including file timeouts, execution times, resource limits, and maximum upload sizes. Increasing your site’s maximum upload limit by modifying the php.ini file is pretty straightforward.
That said, if you’re on a shared hosting plan then you won’t find a php.ini file among your WordPress website’s core files. For this reason, you may have to create one yourself and upload it to your site’s root directory before you begin.
Start off by navigating to your WordPress website’s root directory either through an FTP client or through cPanel and navigating to the wp-admin folder. Find your php.ini file and open it up in a text editor.
Scroll down until you find the upload_max_filesize variable. Now, update the following lines of code to a higher value. For the purpose of this tutorial, we’ll increase the maximum upload limit to 100 MB.
In the code above, we’ve updated four different variables to increase the maximum upload limit and to make sure that our website doesn’t timeout when we upload large files. The M denotes the filesize in megabytes (MBs). Additionally, if you’re not on a shared hosting plan and already have a php.ini file in your site’s root directory, then these four variables might be spread out through the file.
Be sure to click the Save button when you’re done modifying the php.ini file and clear your browser cache. Now, when you visit the Media Library, you’ll be able to see a higher maximum upload limit.
Option 2: Edit the .htaccess File
If editing the php.ini file doesn’t do the trick, you can try modifying your site’s .htaccess file to increase the WordPress upload limit. The .htaccess file is a configuration file that’s used on Apache servers.
To get started, login to your FTP client (or cPanel) and navigate to your site’s root directory. You’ll need to make sure you can view hidden files.
The .htaccess file should be located in the root directory.
Open up the .htaccess file in a text editor and modify (or insert) the following lines of code:
Same as before, we’ve updated three different variables to increase the maximum upload limit and made sure that our website doesn’t timeout when we upload large files. When you’re done editing (or inserting) the code, remember to save the updated .htaccess file.
As a best practice, you should clear your browser cache before accessing your site. Now, when you access your site’s Media Library, you should be able to see the increased WordPress upload limit which, in this case, is 100 MB.
Option 3: Edit the wp-config.php File
If the first two options don’t work out then you can always try adding some code to your WordPress website’s wp-config.php file.
All you have to do is login to your FTP client (or cPanel), navigate to your site’s root directory, and find the wp-config.php file. Next, open it up in a text editor and add the following line of code at the very bottom.
As always, save the file and clear your browser’s cache before checking your Media Library to see if the changes took effect.
Option 4: Edit the functions.php File
If all else fails or you’re simply not comfortable modifying your site’s core files, you can try editing your currently active theme’s functions.php file.
To do this, navigate to Appearance > Editor from your WordPress admin panel. Look for your theme’s functions.php file under the Templates section and open it up in the editor window.
Add the following lines of code at the top:
Remember to click the Update File button at the bottom of the screen. Next, clear your browser’s cache and head over to your Media Library to see if the WordPress upload limit has been increased.
You might have to try out a few different solutions before you find one that works for your website. And if none of the options we presented work or you aren’t able to access any of the core files, then you may have to contact your hosting provider for further assistance. You may be able to simply request that they increase your max upload limit.
Let’s quickly recap the different ways you can increase the WordPress upload limit:
- Editing the php.ini file.
- Modifying your website’s .htaccess file.
- Updating the wp-config.php file.
- Editing your theme’s functions.php file.
Were you able to increase your WordPress upload limit to a larger maximum file size? Let us know in the comments section below!