Increase Maximun File Upload Size WordPress

Increase Maximun File Upload Size WordPress

Many times, when you are working with WordPress, you need to upload a larger file than usual, such as an image, a document or a video. The question is, how to increase maximum file upload size in WordPress?

Depending on your WordPress installation, it is most likely that your file upload size is not too large (maximum upload size in WordPress ranges from 2MB to 150MB depending on the settings of your web hosting provider), this will throw an error.

You can check the maximum file size limit that you can upload to your WordPress if you go to Media → Add New
Increase Maximun File Upload Size WordPress Step 1

1. Edit Your Theme Functions File

In this first step, it may be the case that only by adding this code, the increase in the load size limit is solved.

You can easily increase the size limits by adding the following lines of code in the functions.php file of your theme.

You can edit this file in two ways, from an FTP client, such as Filezilla, or through the file editor of your WordPress Apparence → Theme Editor

Increase Maximun File Upload Size WordPress Step 1-2

Create Or Edit An Existing Php.ini File

To be able to edit this file, you’ll need to access your WordPress site’s root folder by using an FTP or File Manager app in your hosting account’s cPanel dashboard.

If you are using a shared host, this file may not exist. If you don’t see it in your root directory, create a file called php.ini and upload it in the root folder. In that file add the following code:

Update .htaccess File

If we want to increase the maximum upload limit using this method, we must go to the root folder, as we did previously with the php.ini.

You just need to open your site’s root folder and find the .htaccess file. Then, open the file to edit it, and add the following code:

As we said before, if you are using shared hosting, these techniques may not work.

Ask Your Hosting Provider

Many hosts let you change PHP limits from the control panel. In cPanel, for example, look for MultiPHP INI Editor or a similar PHP settings page and raise the values there. If you cannot find the option, or the changes have no effect, contact your host: on shared plans the limit is often set by the provider and only they can change it.

Which Values Matter?

  • upload_max_filesize: the largest single file you can upload.
  • post_max_size: the largest amount of data a single request can send. It should be equal to or larger than upload_max_filesize.
  • memory_limit: the memory PHP can use. Large images may need a higher value.
  • max_execution_time: how long a script can run. Slow connections and big files may need more time.

How to Check the New Limit

Go to Media → Add New and read the maximum upload size shown there, or open Tools → Site Health → Info and look at the Server section. If the value did not change, clear your cache and try another method.

Common Problems

  • 500 error after editing a file: a syntax mistake in functions.php, php.ini or .htaccess can break the site. Restore the original file, or undo the last change, and try again. Always make a backup first; see Best WordPress Backup Plugins.
  • 413 Request Entity Too Large: the limit is set at server level, so your hosting provider has to raise it.
  • Videos: very large videos are better uploaded to a video platform such as YouTube or Vimeo and embedded in your page, which also keeps your site fast.

Once your site is up and running, give it a polished look with one of our WordPress themes for creatives. You may also like: Important Things To Do After Installing WordPress.

Leave a Reply

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

Pin It on Pinterest

Shares
Share This