How to Fix the upload_max_filesize Error of a Server for a WordPress Site

How to Fix the upload_max_filesize Error of a Server for a WordPress Site

Every hosting server sets an upload limit to prevent its users from violating the server allotted to them. If you get the upload_max_filesize error while installing a theme, plugin, or even uploading an image, it means the problem is with the upload limit that you have to increase.

In this tutorial, you will learn to fix this error by increasing the default upload limit using different methods. I am going to use cPanel to access different files to edit or upload.

Method 1). Use the .htaccess File.

You have to access the .htaccess file from cPanel and add only one line to it, and you won’t see the upload_max_filesize error after that.

Here are a few steps to follow:

1). Log into your hosting account and open cPanel. Locate the File Manager because that’s where all files are stored for a WordPress site.

2). For most sites, you have to open the public_html directory from the sidebar. Click on it and you can see all files including .htaccess.

3). Right-click on it and select to edit.

4). A popup will show up to confirm that you’re going to edit the file. Click on Edit, and a new tab will show up with all the coding lines available on the .htaccess file.

5). Add the following line at the bottom:

php_value upload_max_filesize 256M

 

6). Click on save changes from the top-right corner of the editor.

If this doesn’t work, you can increase a few other limits by adding this code:

php_value post_max_size 256M
php_value memory_limit 512M
php_value max_input_time 180
php_value max_execution_time 180

Method 2). Use the wp-config.php File

Just like locating the .htaccess file, you can find the wp-config.php in public_html which is also called the root directory.

At the top, you will see all folders in the root directory. And you will see all the files.

After searching for the wp-config.php file while scrolling down, right-click and choose the “Edit.”

Just like before, a popup will show up, and you have to click on Edit to continue.

Here is the code you have to add before the line “That’s all, stop editing! Happy publishing”.

@ini_set('upload_max_size' , '256M' );

Save changes, and you’re all set.

Method 3). Use the php.ini File

In most shared-hosting accounts, you aren’t allowed to access this file or update it. However, if you can find it in the root directory, open it to edit and add this code:

upload_max_filesize = 256M
post_max_size = 256M
memory_limit = 512M
max_execution_time = 180

Save changes.

If you can’t find it, it means your hosting company has already set PHP limits that you can increase using the .htaccess file.

Method 4). Contact Your Hosting Customer Support

This is the final solution because even after adding coding lines in different or any of these files, only your hosting company’s customer support can help you.

Sometimes, due to security reasons, a company doesn’t allow its users to increase the upload limit. But they can help you fix the upload_max_filesize error.

I hope you have found a solution to your problem.

Conclusion

Once in a while, we all get an error while managing a WordPress.com site. The upload_max_filesize error is one of the most common errors because it’s related to the server that your hosting company manages.

Increasing the file upload limit might seem tricky to many non-techie people. But if you follow any of the above-mentioned methods, you will easily be able to fix this error.

How to Configure WordPress Page Caching

A savvy website owner understand how important it is to have a website with a qu
4 min read
Avi Ilinsky
Avi Ilinsky
Hosting Expert

How to Secure Your WordPress Website

Millions of websites get hacked every year and many people consider WordPres
5 min read
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert

How To Create a WordPress Child Theme

Customizing your WordPress theme but want to be extremely safe? Don’t worry. W
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How to Fix File and Folder Permissions Errors in WordPress

It’s so frustrating when you receive an error while updating your website. File
4 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top