How to increase maximum file upload size in WordPress blog/website?(Tutorial)

in #utopian-io8 years ago (edited)

Have you ever encountered difficulties while uploading larger file/media due to the very Maximum upload file size limit? Though this typically depends on hosting provider you choose to use and the hosting package you purchase, for some reason, it is set to the lower value by default, sometimes as low as 2Mb. Which means we cannot upload any files/medias above that size directly from WordPress admin panel. This also applies for themes and plugins.

And this is a very irritating problem in WordPress if you are a beginner, especially when you have to upload larger files.

wp-file-size1.JPG

But do not panic! This issue can be solved on your own easily, and in this article(tutorial) I'm going to show you exactly how we can solve this issue.

1. The .Htaccess Method.



We can increase maximum upload file size limit by modifying existing .htaccess file in our root directory.We need server access to be able to edit .htaccess file.

Navigate to your WordPress website's root directory using the file manager in control panel. Locate a file .htaccess and click on edit.
Please remember that htaccess file is an important system file which carries various server configuration, most of the hosting providers keep .htaccess file hidden by default. So first check on show hidden file first and find .htaccess file in your root directory.

Now add the following code lines inside the .htaccess, for simplicity add it just below the line where it says # End Wordpress. And Save the your changes.

php_value upload_max_filesize 32M
php_value post_max_size 64M
php_value max_execution_time 300

Replace values like 32M 64M and 300 with your own desired value.


  • php_value upload_max_filesize : Defines maximum limit for upload file size.
  • php_value post_max_size : Defines maximum upload limit that will be handled in post request.
  • php_value max_execution_time : Defines maximum amount of time a php script will run before it terminates.

After modifying your .htaccess file in your server go back to your WordPress admin dashboard and try uploading media. It should increase the file limit as shown in the screenshot below if you have followed every step correctly.

2. The php.ini Method.


Another method we can use to increase maximum upload file size in WordPress is creating or modifying existing php.ini file in the server's root directory.

Navigate your website's root directory using the file manager from cpanel and find a file called php.ini. Click on edit to edit and modify the file.

Search for a line upload_max_filesize and replace the file size with your desired value.
Here I have set it as 20M.

Save the changes and it should increase maximum file upload size in WordPress admin dashboard.

Creating New Php.ini

Sometimes you might not find php.ini file in your root directory especially when you are in shared hosting. If you can't find it, do not worry we can create and add a new php.ini file as well.

To create a new file, click on Add new file tab in the file manager and create a file with name php and ini extension and click on Save button as shown in the figure below.

A new file called php.ini will be created in your directory. Select it and click on edit icon/button to edit the file and add the following lines of code inside.

upload_max_filesize = 20M
post_max_size = 30M
max_execution_time = 300

Please do not afraid to change these values according to your need.

Then click on save button to save your changes.

That's it, you can successfully increase the maximum file upload size limit in WordPress using/adding php.ini.
Now go back to your WordPress admin area and check upload a larger file. It should have increase upload limit there.

3. Theme Functions method.

Another method to increase maximum upload limits in WordPress just by adding some lined of code in your theme's functions.php file. However, I have very less success result using this method. It seems like this method doesn't work for all theme's. So I don't recommend using this method to increase maximum upload limits in WordPress. But if you want to try, just add following lines of code inside your theme's functions.php and check if it works for you.

@ini_set( 'upload_max_size' , '20M' );
@ini_set( 'post_max_size', '30M');
@ini_set( 'max_execution_time', '300' );

Please always feel free to put your own desired value there.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for your contribution
It cannot be approved yet, because it is in the wrong category. The correct category for your post is Tutorial. See the Utopian Rules. Please edit your post to use the right category.

You can contact us on Discord.
[utopian-moderator]

Sorry, don't know how did i make that silly mistake.
Edited..

no worries, approved :)

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by asis from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews/crimsonclad, and netuoso. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP. Be sure to leave at least 50SP undelegated on your account.

Hey @katteasis I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.04
TRX 0.31
JST 0.074
BTC 63095.06
ETH 1654.42
USDT 1.00
SBD 0.42