How to change maximum media file size in WordPress

If you have just started working on your new website powered by WordPress, you might have come across a problem with uploading your pictures or other media files. Most of the hosting providers out there have limited file sizes to 2Mb per file. Even if you have installed WordPress on localhost, you might need to change this limit.

Since an average image file you have taken with your camera or your smartphone is weighing much more than just 2MB, you are in trouble because you won’t be able to upload it. Also, many plugins and themes will be larger than the limit on your server.

So, what to do? One option is to edit those images and fit them under 2MB. But what if that is not the acceptable option? Then you have to change max media file size directly on your server.

Before we show you how to change this limitation, it is important to know that some providers will stile overwrite your settings. In that case, you will have to contact your hosting company and ask them to change the file size for you.

There are several methods to change max media file size in WordPress:

Use a plugin:

We all love WordPress for its extensibility. Almost anything can be done with plugins, even if you don’t know how to code. And, of course, you can change max media file size with a plugin as well.

One of the many plugins which can help you in this case is Increase Upload Max Filesize plugin which can be installed from WordPress plugin repository for free. This plugin will edit your php5.ini file (or create one if needed), and automatically set file max size to 32Mb. If you want to, you can change maximum file size to any number you want.

If you navigate to Tools->Upload Max FileSize you can easily view your current settings, set up custom numbers or choose php.ini instead php5.ini to be used.

If you can’t upload larger files even after installing the plugin, it probably means your server is overriding your actions and you will have to contact your hosting company.

Or edit php.ini file:

If you don’t want to use the plugin, you can edit the php.ini file by yourself.

  1. Connect to your web server with FTP client like FileZilla
  2. Search for php.ini file or create one if there is no file found
  3. Open the file and paste the following code:
  4. upload_max_filesize = 30M
    post_max_size = 30M
    max_execution_time = 300
    
  5. Save changes

After this, give your server a minute or two to recognize the changes and you’re ready to upload files up to 30Mb. Of course, you are free to change the number to anything you want and need.

Or edit .htaccess file

This is another method which can be used for editing your server configuration.

  1. Connect to your FTP server
  2. Find .htaccess file
  3. Open it and paste the following code:
  4. php_value upload_max_filesize 64M
    php_value post_max_size 64M
    php_value max_execution_time 300
    php_value max_input_time 300
    
  5. Save changes

Or Modify the functions.php file:

You can achieve the same thing by editing your functions.php.

  1. Open functions.php file
  2. Paste the following code:
  3. @ini_set( ‘upload_max_size’ , ’64M’ );
    @ini_set( ‘post_max_size’, ’64M’);
    @ini_set( ‘max_execution_time’, ‘300’ );
  4. Save changes

 

That’s it. We’re sorry if you were expecting a fifth method which will lead you to the same results, but you’ll have to choose one from the above. If changing the files doesn’t let you upload bigger files to your library, please contact your hosting company.

START YOUR OWN BLOG

This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

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