How to Increase Maximum File Upload Size in WordPress

Default max upload file size in WordPress

Advertisements

If you have tried to upload a large media file to your WordPress site before, you might have seen an error message telling you that it exceeded the maximum file upload size. This can be quite a roadblock, especially if you’re creating a site with lots of media elements such as images and video.

Fortunately, there are ways to get around this limit. Whether you’re new to coding, more familiar with it, or want to avoid that route altogether, there’s a method for you to increase your maximum file upload size and get your content published. 

In this tutorial, we’ll discuss what determines your default maximum file upload size and why it exists. Then, we’ll explore three simple methods that you can use to increase this number. Let’s get started!

Why Increase Your Maximum File Upload Size

You might be asking yourself why there’s a maximum file upload size in WordPress at all. Plenty of people use WordPress to share all kinds of media with huge files. If it can be increased anyway, what’s the purpose of putting a default cap on it?

The answer is twofold.

First, it’s not WordPress that sets these limits but your hosting provider. The maximum upload file size is a server-level setting, and as such, it’s up to them.

You can find your initial limit by navigating to Add New under Media in your WordPress dashboard’s sidebar. In this example, the upload limit is 8 MB:

Default max upload file size in WordPress

Some hosts keep your limit as low as 2 MB, others will set it around 40 MB, and some top out at a whopping 150 MB. It all depends on your host and what they have decided to provide. 

Advertisements

Second, while the limit can be a bit of a challenge for some users, it serves an important purpose. A maximum upload size keeps malicious users from flooding your site with huge files that can slow down your servers.

Still, you might have to increase the limit at some point. Videos, audio files, and high-quality photos can have larger requirements than your host starts you out with. This can be an issue if you’re trying to integrate more media into your WordPress site.

Fortunately, there are a few ways that you can set the limit you need. If you’re trying to get ahead of bot uploads, you also might want to consider pairing one of the following methods with a comment plugin that has anti-spam functionality. 

How to Increase Maximum File Upload Size in WordPress (3 Methods)

So, how do you increase your website’s maximum upload size? There are three main ways to do this — let’s look at each in turn.

Before that, however, it bears repeating that every host works a little differently. It’s possible that some of these methods won’t work with your provider. I recommend trying one solution at a time until you find the one that fits your needs.

1. Add Some Code to Your WordPress Site’s .htaccess File

Our first method involves digging into your site’s code and accessing its .htaccess file. If you’re not a fan of code, don’t worry! You won’t have to write any yourself.

All you have to do is copy and paste some pre-written lines. That makes this a good approach if you’re comfortable with accessing your site’s files, but not as experienced in actual development. 

The .htaccess file is a core part of your WordPress site. While it serves several purposes, the one we’ll focus on here is its relationship to the server. By adding some code to .htaccess, you’re giving instructions to the server to lift your limit.

Of course, a server can only provide what the host permits. For example, if your host doesn’t have the ability to support 150 MB uploads, changing the limit to 150 MB in the .htaccess file won’t have the desired effect. If you’re in any doubt about what your host enables, you can contact them directly for more details.

You’ll also need a file manager to get started. If you don’t have a File Transfer Protocol (FTP) client yet, I recommend FileZilla. It’s a reliable tool to use with your WordPress site and learning how to operate it is fairly straightforward.

Once you have accessed your site’s files using FileZilla, open your WordPress root folder to find your .htaccess file:

Advertisements

Open root folder in FileZilla

Then, open the .htaccess file using a text or code editor. Copy and paste the following code at the end of the file:

php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 300
php_value max_input_time 300

You can use different values, too.

Your .htaccess file should now look something like this:

.htaccess file with modified PHP values

Save the file and re-upload it to the server. Then revisit your site’s upload screen. Your upload size should now be increased to 128 MB (or whatever value you chose). If it hasn’t changed, you can delete your additions to the .htaccess file and move on to our next strategy.

2. Create or Edit Your WordPress Site’s php.ini File

This method will also require you to use FileZilla and root around in your site’s code. However, since it might require the creation of a new file, it’s a bit trickier than the .htaccess approach.

What you’ll need to do is create a file called php.ini, which will override your server’s PHP configuration settings. One of those settings is your maximum upload size.

Similar to the .htaccess method, this can’t expand your upload size beyond the server’s maximum capability. Fortunately, that maximum is typically more than enough for typical WordPress uploads.

If you’re a bit more experienced with using an FTP client to access website files, this is a good method to try. It can also be a useful introductory challenge if you’re looking to practice your development skills. 

The first step is to use FileZilla to open your site’s root folder:

Open the root folder, with the php.ini file highlighted

Check to see if there’s already a file named php.ini. There’s a good chance that it won’t be there. In that case, simply create a file in your text or code editor, name it “php.ini”, and save it in your root folder.

Then, copy and paste the following code into your new blank file:

memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

Once you’ve entered the code, make sure that you’ve saved the file in the right place. After that, you can check your WordPress upload screen. The maximum upload file size should now be increased to 64 MB.

If you’re not having luck with this approach either, delete the new php.ini file. If there was already a php.ini file when you started, just remove the code you pasted in. Once you have that all cleaned up, you can move on to our third and final tip.

3. Contact Your Web Host Directly

Since your file size limit is directly controlled by your web hosting provider, they likely also have the power to increase it for you. You might have to wait a bit depending on your host’s customer response times, but contacting them can be a straightforward way to approach this problem.

If neither of the above methods has worked for you, this is the way to go. It’s also a good option if you’re not interested in altering your WordPress site’s files and would rather have someone else handle this task.

All you need to do here is reach out to your host’s support team to see if they can help. Many hosts are happy to accommodate reasonable requests. In addition, keep in mind that this is another reason to consider the importance of a robust customer support team when you’re examining your hosting options.

Conclusion

The maximum file upload size can be a tricky limit to work around. Fortunately, you can increase it with a little bit of code or some help from your hosting provider.

In this tutorial, we covered three ways to help you increase your WordPress site’s maximum upload size:

  • Use code to adjust the existing .htaccess file
  • Create or edit the php.ini file in your site’s root folder
  • Reach out to your web host for assistance
  • What will you share with your new file upload limit? Let us know in the comments section below!