Skip to main content

How to Increase Media File Maximum Upload Size in WordPress

increase upload size wordpress
WordPress is a powerhouse with so many themes and plugins that allow you to build just about any kind of website. From ecommerce to a simple blog, WordPress has you covered. However, when choosing a web hosting for WordPress, you should consider performance, security, and support in the first place.
If you are building a WordPress website that hosts a portfolio with large image files or a video hosting site with single media file size running into GBs, then you might face a roadblock of not being able to upload media files larger than 25MB (in most cases).
500 Internal Server error always seems to come at the most untimely manner and users suddenly go to find how to get a WordPress website online.
By default, the maximum upload size in WordPress ranges from 2MB to 150MB depending on the settings of your web hosting provider is giving by default.
To check what is the current max upload size limit in your WordPress site then navigate to WP Admin → Media → Add New. You will see the current max upload size on the bottom as shown in the screenshot.
WordPress increase upload size
If the current max upload size limit meets your demand then you can leave it as it is. However, if it doesn’t then don’t fret, there are many ways you can increase the max upload size in WordPress. I am going to highlight the following ways in this tutorial.
Note: This guide is written to provide all possible solutions. However, some may not work on the majority of the web hosts. In this case, the best solution is to contact your hosting provider.

1. Update .htaccess file

If your web server is using Apache and PHP is set as an Apache module, then you can add a few lines of code in your WordPress .htaccess file to increase the max upload size in WordPress.
To access your .htaccess file, connect to your server via FTP client and navigate to the folder where WordPress is installed. Open up .htaccess file in a code editor or Notepad and add the following lines.
  1. php_value upload_max_filesize 64M
  2. php_value post_max_size 128M
  3. php_value memory_limit 256M
  4. php_value max_execution_time 300
  5. php_value max_input_time 300
This will define the max upload size in Megabytes. Replace the numbers as per your requirement. The max execution time and max input time are in seconds. The execution time defines the limit of time spent on a single script. Choose a number that is suitable for your site.

2. Edit Functions.php File

In some cases, you might not be able to access your .htaccess file or you are more comfortable editing WordPress theme files.
You can easily increase the size limits by adding the following lines of code in the functions.php file of your theme.
However, remember if you change the theme then max upload size will return to its default values until you edit the functions.php file of the new theme.
  1. @ini_set( 'upload_max_size' , '64M' );
  2. @ini_set( 'post_max_size', '64M');
  3. @ini_set( 'max_execution_time', '300' );

3. php.ini Option

This is a default file used to configure any application which runs on PHP. This file contains parameters required for file timeout, upload size, and resource limits. Access your WordPress root directory using SSH or FTP and look for a php.ini file. In some cases, this file is not visible to the other option would be to create a new file instead.
Open any text editor and create a new file. Copy the following code and save it as php.ini.
  1. upload_max_filesize = 25M
  2. post_max_size = 13M
  3. memory_limit = 15M

increase upload size wordpress in php.ini file

Now, upload that php.ini file using SSH or FTP inside the same root folder.

4. Increase Upload Size in Multisite

If you are running WordPress multisite, then upload size can be increased from settings. This increase is dependent on your server settings. If your server is set to 20MB you cannot increase WordPress upload size to 25MB. However, if your server is set to 20MB your network setting is set to 15 MB then you can resolve the issue by increasing the upload size to 20MB.
wordpress multisite maximum upload file size

5. wp-config.php File

Another way of increasing the upload size in WordPress is to define the size parameter in the wp-config.php file. To do that, access your WordPress root directory using SSH or FTP and locate a wp-config.php file.
wp-config.php
Open the file in any text editor and add the following code.
  1. @ini_set( 'upload_max_size' , '20M' );
  2. @ini_set( 'post_max_size', '13M');
  3. @ini_set( 'memory_limit', '15M' );
Save your changes and it should increase your file upload size.

6. Plugin Method

Not everyone is a fan of writing code or accessing root files using SSH or FTP. For that situation, the plugin comes in handy and luckily there is a WordPress plugin available for increasing WordPress upload size. The plugin we will be using is Increase Max Upload Filesize plugin.
Go to your WordPress Dashboard → Plugins → Add new, search “Increase Max Upload Filesize” then activate and install the plugin. Once installed, go to plugin settings and simply enter the value for upload size.
increase file upload size wordpress plugin
Click the Save Changes button to apply the new upload size.

7. Contact Your Hosting Provider

If you do not want to edit the files yourself then you can always contact your hosting provider to do it for you.
If you are using Cloudways WordPress managed hosting, then you can easily increase the max upload size limits of all your websites on a single server through the options in the platform. It is only a matter of a few clicks.
To edit upload size limit, log in to your Cloudways account navigate to Server under the Server Settings & Packages edit the Upload Size field as shown in the screenshot. Don’t forget to click on Save Changes at the bottom of the screen.

Conclusion

WordPress is a versatile CMS. There is always a way to do something. If you are not able to find an answer to any of your issues pertaining to WordPress, then you can always go and ask in the ever helping the WordPress community. I am also a part of that awesome community, so you can always reach out to me as well.
This is for personal documentation purposes.

THANK YOU!

Comments

Popular posts from this blog

Reset 120 day RDS Grace period on 2016 and 2019

  Reset 120 day RDS Grace period on 2016 and 2019 Enter the following command to check Grace Period: wmic /namespace:\\root\CIMV2\TerminalServices PATH Win32_TerminalServiceSetting WHERE (__CLASS !=””) CALL GetGracePeriodDays  Confirm-deletion-of-the-timebomb-key-in-the-registry If you have a home lab environment or another lab where you continually test various solutions, licensing, and trial expiration is a challenge that you constantly tend to run into. It is just part of the fun of lab environments. While most trials are fairly “hard and fast” and don’t allow you to reset the trial expiration, if you work with Microsoft Windows Server and Remote Desktop Services (RDS), there is a “hack” that allows you to effectively reset the expiration of  Remote Desktop  Services grace period where you can essentially rewind the clock on your RDS licensing if you are making use of this role inside your lab environment. I am using Windows Server 2019 for my Windows workloads in...

Remote Desktop Services session timeout Setup in RD Session Host in Windows Servers

  If you face a session time-limit policy issue that gets disconnected in the meantime. You can follow the steps below in order to fix the issue, By default, the user’s RDP session in Windows may stay disconnected until the user or administrator terminates, or the computer is restarted. However, it is quite convenient since a user may connect to his old RDP session and go on working with running programs. In order to terminate disconnected RDP/RDS sessions automatically in a specified time period, you need to set session limits (time-outs) correctly. If you are using an RDS server, you will have to configure session time-out parameters from the RDS collection settings in the Session tab menu. You will have to Specify the time period after which you want to disconnect the RDP session. Lastly, a disconnected session option (by default, a session period is unlimited – Never). Thus, you can set the maximum duration of an active session (Active session limit) and end an idle session (Id...

GitLab Repository Command Line Instructions

Start project repository Command line instructions You can also upload existing files from your computer using the instructions below. Git global setup git config --global user.name "Jaime Moncada" git config --global user.email "jaimemoncadajr@gmail.com" Create a new repository git clone https://gitlab.com/jaimemoncadajr/library-system.git cd library-system touch README.md git add README.md git commit -m "add README" git push -u origin master Push an existing folder cd existing_folder git init git remote add origin https://gitlab.com/jaimemoncadajr/library-system.git git add . git commit -m "Initial commit" git push -u origin master Push an existing Git repository cd existing_repo git remote rename origin old-origin git remote add origin https://gitlab.com/jaimemoncadajr/library-system.git git push -u origin --all git push -u origin --tags Credit :  https://gitlab.com OR Simple Way to Push an existing ...