How to Increase the WordPress File Upload Limit

How to Increase the WordPress File Upload Limit

One of the biggest conveniences of a website is having a place to easily share files with visitors. Items such as printable forms, eBooks, videos, music and images come to mind.

For those of us who use WordPress as our content management system (CMS), adding these types of files is relatively easy via the Media Library. There’s even a built-in way to embed multimedia files, galleries and playlists.


But, depending on your particular setup, you may run into rather restrictive file upload size limits. This makes it difficult to post, say, a full screen HD video or a .ZIP archive of high-resolution PDF files.

Thanks to WP, the upload limit can be increased in most situations, and it’s fairly easy to accomplish. However, the method for doing so greatly depends on your web hosting environment. Let’s take a look at what settings need changed, along with a few different approaches for making them.

What You’ll Need to Change

To increase the WordPress file upload limit, you’ll have to change some settings within your hosting account’s PHP configuration. Of course, web hosting companies vary greatly when it comes to server configurations and their own policies for making changes.

Therefore, the approach you take depends largely on which method your host supports. Check out their documentation or ask a support representative to find out what is recommended.

But regardless, we’ll want to change (or at least review) the following settings:

We’ll get to what they do in a bit. For now, it’s important to know that each of these items (particularly the first three) have a role to play when it comes to uploading files. The last one has a say in processing them (like an import file full of posts, for example), which can also be relevant.

Methods for Changing Upload Limits

Now that we know which settings we’ll want to change, it’s time to do some research. Talk to your web hosting provider regarding which method(s) they support for tweaking PHP settings. It will likely be one of the options below.

Just note that editing these settings is serious business. Therefore, be sure to make backup copies of any files before making changes. One false move could potentially cause your site to go down.

With that, here are some of the most common methods for increasing your WordPress file upload limit:

In Your Hosting Control Panel

One of the easiest possible ways to adjust these settings is by changing some numbers around in your web hosting control panel. Hosts that use cPanel or a similar GUI may allow you to change PHP settings directly in your browser.

Directly Editing the php.ini File

Some hosts (or if you’re running a local hosting environment) enable direct access to your account’s php.ini file. This can be accomplished by downloading the file via FTP, making changes, then uploading it back to its rightful spot on your server.

Alternatively, you may be able to access it via a command line. This is expert territory, though, so be careful!

Creating and Uploading a .user.ini File

Many hosts would rather you didn’t have direct access to the full php.ini file – and for good reason. As an alternative, they’ll allow you to create a file called “.user.ini”, which lets you manually add and change just the settings you need.

From there, upload it to your server (usually the root directory of your website) and your new settings will override the defaults. This method offers an extra bit of safety, as even if you make a mistake, you can quickly fix or remove the file altogether.

Modify Your .htaccess File

On some hosts, you can tweak PHP settings via your site’s .htaccess file. This is a hidden file usually found in your site’s root directory. You may have to adjust your FTP software settings in order to see it.

However, use caution when editing this file and keep backups. .htaccess can be used for a number of different server settings, and WordPress depends on it for its Permalink structure.

Setting Values

Once you know how and where to change the PHP settings for your website, it’s now a matter of implementing them. But what are the right values?

This really depends on your specific needs. In most cases, you’ll have some flexibility when increasing your file upload limit. However, the higher the limit, the more potential server resources you’ll use. So, keep that in mind when making changes.

For our purposes, setting the limit to a healthy 24MB should fit most needs – but you can set yours to whatever you like. Here’s how it’s done.

If you’re editing existing settings in your php.ini or creating a .user.ini file from scratch, your settings will look something like this:

upload_max_filesize = 24M
post_max_size = 26M
memory_limit = 28M
max_execution_time = 300

If you’re editing an .htaccess file, your settings will look like the following:

php_value upload_max_filesize 24M
php_value post_max_size 26M
php_value memory_limit 28M
php_value max_execution_time 300

Now, let’s provide a little context as to what these settings do and how we arrived at these specific values.

upload_max_filesize = 24M
This setting will allow for uploading a file that is up to 24MB in size (note that the setting itself uses “M”, rather than “MB”). It can be changed to any number you like, within reason.

post_max_size = 26M
In general, post_max_size should be set to a higher number than upload_max_filesize to ensure some breathing room. As shown here, the setting doesn’t have to be significantly higher – just a little bit extra will do the trick.

memory_limit = 28M
Subsequently, memory_limit should be set even higher still. Following this formula will help to keep things running smoothly.

max_execution_time = 300
This one is completely optional. It sets the number of seconds (300, in our case) that a PHP script is allowed to run before terminating.

However, it does come in handy when a file upload is being processed by a PHP application, such as WordPress. For example, if you’re uploading a really large file to the Media Library, WordPress (and potentially a plugin) will then need to process the file. That can take a significant amount of time.

Increasing max_execution_time will help to ensure that the process doesn’t time out before it’s had a chance to finish. Again, you’ll want to check with your host to see what is recommended here.

One Size Doesn’t Have to Fit All

The beauty of WordPress is that is offers great flexibility. Not only can themes and plugins help you build a website to match your exact needs, but there are a number of “under-the-hood” customizations you can make as well. Many of them tie in directly with PHP.

For those of us that need to upload large files, a quick change to the PHP settings is all it takes. It’s just one more way to make a WordPress website your own.

Fancy you stumbling on my piece of the internet. Bonjour!

My name is Anmol and I'm the Blogger-In-Chief of this joint & working as the Chief Technology Officer at Azoora, Inc. I'm putting up my views here trying to help creative solopreneurs, developers & designers build their business using the power of websites, apps & social media, this, is, my jam.

If you're looking to start your own online business with a professional high quality website or mobile app, just get in touch. I'd be more than happy to assist.

SKYPE | FACEBOOK | LINKEDIN | TWITTER | EMAIL

Leave a Comment

Your email address will not be published. Required fields are marked *