How to Increase the Maximum File Upload Size in WordPress

Share on facebook
Share on twitter
Share on email

Site owners sometimes run into problems when trying to upload large files to WordPress blogs or websites. The issue is that the file(s) you want to upload is too big for your account. Don’t despair. There’ are workarounds on how to increase the maximum file upload size in WordPress. Before we get into the fixes, let’s first look at the cause behind this common frustration.

Why You Can’t Upload Large Files to WordPress

Every online WordPress.org website or blog needs a web hosting company. The host sets the upload limit for your account, and the cheaper the hosting, the lower the limit. You can see what this limit is from your WP Admin Area, so let’s head over there and take a look.

Log in to WordPress as Administrator.

Click Media => Add New from the Dashboard side menu.

You’re now at the Upload New Media screen.

You can check the settings here for your allocated maximum upload file size (bottom left).

The Maximum upload file size for the test site is 512 MB. That’s plenty for uploading most files, themes, and plugins. But you’re having issues, so there’s a good chance that your maximum file upload limit is much lower than this. The easiest way to solve this issue is to contact your web host and ask them to increase it. They’ll most likely suggest an upgrade, though.

Don’t worry; an upgrade is not the only solution.

3 Ways to Increase WP Max File Upload Size

The methods in this guide show you how to upload larger files without the upgrade. They won’t all work for every situation, but they’re certainly worth a try. Each approach requires modifications to critical files and are not recommended for WordPress beginners.

The three potential solutions are:

  1. Edit the functions.php file
  2. Modify the .htaccess file
  3. Modify (or create) php.ini files

We can edit files from the WordPress Dashboard, using an FTP client, or via the File Manager in cPanel. Every WordPress site owner has access to cPanel, so we use that for this guide. You can also use FTP if you prefer, as the modifications are the same for either method.

Read What is cPanel first if you’re new or need a refresher for this popular control panel.

PLEASE DO A FULL WORDPRESS BACKUP BEFORE YOU CONTINUE WITH ANY METHOD

#1 Edit your functions.php file

All WP themes have a functions.php file that we can tweak to increase the max file upload size. It’s important to know that the file upload limit returns to the default if you switch to another theme. That means you’d need to repeat the process if you change themes.

Read “How to Open and Edit Your Functions PHP File if you’re new or need a refresher.

Log into your WP Dashboard

Locate and open the functions.php file from the Theme Editor/Edit Themes screen

Add the code below to the end of your functions.php file.

 

@ini_set( ‘upload_max_size’ , ‘64M’ );

@ini_set( ‘post_max_size’, ‘64M’);

@ini_set( ‘max_execution_time’, ‘300’ );

 

Click Update File to save the changes.

#2 Modify the .htaccess file

You need to access your WP root folder to update the .htaccess file using FTP or File Manager in cPanel. We’ll use File Manager as every hosting account provides users with a cPanel.

Read: What is cPanel if you’re new to this or need a refresher.

Tip: Make a copy of your .htaccess file first if you haven’t done a full site backup.

Log in to the cPanel account for your website.

Click File Manager from the FILES box.

File Manager opens in a new browser tab.

Click on your site’s root directory.

Locate and right-click on the .htaccess file, then select Edit from the pop-up menu.

Add the code below to the end of your .htaccess file.

php_value upload_max_filesize 64M

php_value post_max_size 64M

php_value max_execution_time 300

php_value max_input_time 300

Click Save Changes.

Point to note: This method won’t work with all shared hosting accounts. Contact your web hosting providers support services for assistance if it fails. They may increase the file upload size for free or suggest an upgrade (most likely). Alternatively, move to the next fix.

#3 Modify (or create a new) php.ini file

The process for the php.ini file is like the .htaccess in that you add code to the file and save it. This file is not always visible on shared hosting accounts. Don’t worry; you can simply create a new one if that’s the case with your site.

Jump to ‘editing your php.ini’ if you can see it in your root folder.

Keep reading if you need to create a new one.

How to create a new php.ini file in cPanel

Select your site’s root (public_html) folder in File Manager.

Click the File link on the top bar (left).

Type php.ini into the New File Name box.

Ensure the ‘New file will be created in:’ shows the site’s root folder (public_html).

Click Create New File

Editing your php.ini

Right-click the php.ini file and select Edit from the pop-up menu.

Add the code below to your php.ini file.

upload_max_filesize = 64M

post_max_size = 64M

max_execution_time = 300

Click Save Changes

Tip: Try reducing the file size if 64M doesn’t work. Start at 10M. If it works right away, you may want to tweak the three values to increase the file upload size still further.

One of the three methods should work in most cases. If not, contact your hosting company to see what options you have, or move to another host that offers larger file uploads.

Share on facebook
Share on twitter
Share on email
You may also like

Subscribe to my newsletter

Subscribers to my newsletter get all the latest news, reviews, advice and gossip in the world of search engines, internet marketing, self-publishing, and North Wales (where I live). You can sign up for my free newsletter by clicking this link.

My Books

I have a range of webmaster related books for sale on Amazon in both Kindle and Paperback formats. WordPress, SEO & Self-Publishing.
On Amazon

My Online Courses

My courses cover a range of webmaster related skills, from learning WordPress itself, to installing an SSL certificate on your site.
On Udemy

Comments

Hello, I'm
Andy Williams!

You can get up to 90% off my Online Courses for webmasters, marketers & affiliates (plus a free course on Gutenberg).

Get my newsletter
delivered to your inbox

18748

We respect your privacy

18749