Are you looking to increase the WordPress file upload size limit? You may face a problem uploading a large file if your server is set for a lower file size limit. In this article, I show you different ways for increasing the limit of file upload size in WordPress.
A user can see the allowed file size limit by going to the Media->Add New.
In my case, it’s set to 2MB. It means I can’t upload files greater than 2MB. If I try a bigger file, I get an error something like the below screenshot.
Increase WordPress File Upload Size Limit
I am going to discuss 4 different approaches to change file size limits in WordPress. I suggest trying all options one by one and see which one works for you. It’s also recommended if any approach will not work for you, remove or revert those changes immediately.
For this tutorial, I assume the user wants to set the file size limit to 64MB. You can change this value depending on your requirement. So let’s see it one by one.
1 – Using htaccess
I am starting with the .htaccess
file. Each WordPress installation has this file in the root folder.
Open your .htaccess
file from the root directory and add the below lines after the # END WordPress:
# END WordPress
php_value upload_max_filesize 64M
php_value post_max_size 72M
We should always have a higher value for post_max_size
than upload_max_filesize
. This is because when we post the file to the server additional data may also be sent at the same time.
Now, go to the Media->Add New page and refresh it. You may see the size limit is 64MB. If it doesn’t work, revert the changes and try the next approach.
2 – Using Code
In this approach, you need to add the below code to your active theme’s functions.php
file.
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '72M');
Users can also place this code in wp-config.php
file.
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '72M');
/* That's all, stop editing! Happy blogging. */
Check again on the Media page if you get your limit increased else remove these changes.
3 – Using PHP.INI file
For some reason, if the above options did not work for you try this one. In this case, you need to update 2 lines in your php.ini
file. Find the strings upload_max_filesize
, post_max_size
and set values 64M, and 72M respectively.
If you don’t have access to php.ini
, create the new one in your root folder. You need to add the below lines to it.
upload_max_filesize = 64M
post_max_size = 72M
4 – Using Web Hosting Tool
If all the above approaches failed to achieve your goal, the final option pending is a web hosting tool.
Keep a note if you are not comfortable with the next step then please contact the hosting support team and they will do it for you.
Log in to your web hosting account. In the search field type ‘ini’ and you should get the option for ‘MultiPHP INI Editor’. Click on it.
On the next screen, you will find a provision to set values for post_max_size
and upload_max_filesize
. For them add the values 72M and 64M respectively. Don’t forget to click on the ‘Apply’ button.
Check out your Media page and you should now be able to upload a file up to 64MB in size.
I hope you understand the increasing file upload size limit in WordPress. Please share your thoughts and suggestions in the comment section below.
Related Articles
- How to Build Custom Elementor Widget
- How to Add Code After the Body Tag in WordPress
- How to Add Image Field to Taxonomy in WordPress
If you liked this article, then please subscribe to our YouTube Channel for video tutorials.