Large media files, plugins, and themes cannot be uploaded to WordPress because of the limited upload size. That can be a major challenge when a website demands lots of media. In such situations, it is necessary to raise the maximum upload size in WordPress or the server.
What Is the Maximum Upload Size for Media Files on WordPress?
Large media files that are uploaded to the server usually take up plenty of the server’s resources. WordPress’ default maximum upload size is from 4 MB to 128 MB in order to prevent users from causing server timeouts. Typically, the hosting company establishes this cap at the server level.
How to check the Current Maximum Upload Size in WordPress
You can check your site’s existing maximum upload size by navigating to:
WP Admin > Media > Add New.
You can also check the size limit by using the Site Health Info tool available from version WordPress 5.2 onwards. There are two ways to determine the maximum upload file size on the screen since the server and WordPress both handle these issues.
It is first listed in the Media Handling dropdown menu. Find the constant max size of an uploaded file value.
The second approach is to search in the Server dropdown. In this section, you can find a lot of options for setting up your web server. To find out more, conduct a search for the constant upload max media file size value.
Why Increase the Maximum Upload Media File Size on a WordPress Site?
The maximum upload file size needs to be increased for a variety of reasons. Here are a few of them:
- To use the WordPress admin dashboard to directly install a sizable theme or plugin.
- The best way to keep readers interested and to come back for more is to regularly update your WordPress site. Uploading fresh photos, movies, songs, and other types of media on a regular basis is part of this. When there is a size restriction on your uploads, it isn’t possible to frequently update the media files.
- To upload a sizable video or image for the site’s header or background.
- When someone intends to sell digital files directly from a website, including ebooks, videos, images, plugins, and themes. Such files may occasionally be several hundred megabytes in size (or larger).
How to Increase Media File Maximum Upload Size in WordPress?
The best techniques for increasing WordPress’s maximum upload size for media files are listed below:
-
Updating .htaccess File
You can update your website’s .htaccess file to enhance the maximum upload size in WordPress if your web server is Apache. You can access the .htaccess file by connecting to the server through an FTP client and going to the folder in which WordPress is installed.
Add the following lines in the .htacess file code editor:
php_value upload_max_filesize 64M
php_value post_max_size 128M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300
The maximum upload size is defined as megabytes. However, you can alter the numbers according to your need.
-
Editing functions .php File
It may happen that you might not be able to access the .htaccess file. It is easier for many people to edit the WordPress Theme File.
Access the functions.php file from Dashboard> Appearance > Theme File Editor. Select the Theme Functions File. Add the following lines of code to increase the size limit:
But keep in mind that if you switch themes, the maximum upload size will revert to the default settings till the functions.php file of the new theme is edited. The code below is added only to the current theme:
@ini_set( ‘upload_max_size’ , ’64M’ );
@ini_set( ‘post_max_size’, ’64M’);
@ini_set( ‘max_execution_time’, ‘300’ );
-
Creating or Editing the php.ini File
This is the file that is used by default to set up all PHP applications. This file includes the required settings for file timeout, download size, and resource limits. Login to the WordPress root using SSH or FTP and locate the php.ini file. If the file is not visible, create a new file.
- Open a text editor.
- Create a new file.
- Then, copy the code given below.
- Save the filename as php.ini.
upload_max_filesize = 64M
post_max_size = 128M
memory_limit = 264M
A new PHP.ini file should be uploaded through SSH or FTP to the same root folder.
-
Increasing the Upload Size in Multisite
For those who are using a WordPress multisite network, you can change the network’s maximum upload file size.
Network Administrator Dashboard> Settings > Network Settings
Scroll down to locate the Upload Settings section. Here you’ll see the Max upload file size field.
The default limit for the maximum upload file size in WordPress is 1500KB (~1.5MB) on several sites. Change the size to a higher value. Click on Save Changes. Here, you cannot bypass the server-level maximum upload size limit. If you specify a limit here that is greater than the server’s maximum upload size limit, the server will overlook it.
-
Modifying the wp-config.php File
Modifying the size parameter in the wp-config.php file is also one of the ways to increase the upload size. You can achieve this by accessing the WordPress root directory via SSH or FTP and looking for the wp-config.php file.
Insert the following code to the file:
@ini_set( ‘upload_max_size’ , ’64M’ );
@ini_set( ‘post_max_size’, ‘128M’);
@ini_set( ‘memory_limit’, ‘256M’ );
This doesn’t work because you can only use the ini_set() function to set the PHP directives owned by the PHP_INI_ALL variable.
Because upload_max_size and post_max_size belong to variable mode PHP_INI_PERDIR. They can only be set via php.ini, .htaccess, http.conf or .user.ini.
-
By Using a Plugin
Coding is surely not everyone. Besides, WordPress provides an easy solution for using the plugin to increase the upload size limit. Install and activate the Increase Maximum Upload File Size plugin.
On successful installation and activation, navigate to Plugin Settings > enter your required value for upload size. Click on Save.
-
Contact Hosting Provider
The easiest solution to your trouble is to contact your hosting provider. Maximizing the upload limit comes under the technical support tasks. Therefore, most companies would be able to help you fix this issue. Our excellent and knowledgeable support team at Nestify is available 24*7 to help you. We are just a chat away!
Conclusion
This article covers all the ways that can be used to increase the upload size of media files in WordPress. If you find any trouble executing the solution, the best way is to contact your hosting provider. We hope you find this article useful. If you have any queries, do let us know in the comments below.