Maximum Size in Bytes of Image to Allow Upload
A low WordPress upload size limit stops you from uploading large files, plugins, and themes. If y'all're edifice a media-heavy website, that can be a considerable obstacle. Information technology's necessary to increase the max upload size in WordPress or your server (or both) in such cases.
Depending on your hosting provider and server, at that place are many ways to go about solving this outcome. We'll cover them all in this article and show you how to increase the maximum upload size in WordPress rapidly.
Let's dive in!
Adopt to watch the video version?
What Is the Maximum Upload Size in WordPress?
Uploading large files to a server consumes a lot of the server's resources. To preclude users from causing server timeouts, the default maximum upload size in WordPress typically ranges from 4 MB to 128 MB. Usually, the hosting provider sets this limit at the server level.
WordPress likewise includes constants that ascertain this limit, only they cannot override the server-level settings in most cases.
To verify this, become to your WordPress site'due south Media Library. Here, attempt to upload a file that crosses this maximum upload file size limit. You'll run into an error message that looks something similar this:
The "exceeds the maximum upload size for this site" error can be frustrating, but it exists for 2 main reasons: security and efficiency. Information technology hinders site owners and other users, including malicious actors, from uploading huge files (e.grand. loftier-resolution images, big videos).
Otherwise, it can upshot in incapacitating your website's server, making your site come to a crawl. Or worse, information technology tin bring your site down birthday!
How to Cheque the Current Maximum Upload Size in WordPress
At that place are many ways to cheque your WordPress site'south current max upload size. Let's become through all of them.
In the Media Library
The quickest way to check your site'south current maximum upload size is to become to your WordPress dashboard, and from there, go to Media > Library. Here, click on the Add New push to activate the media uploader tool.
As Kinsta hosts this site, the Maximum upload file size: 128 MB.
message displays below the Select Files button. If you're using a different web hosting provider, you may meet a different limit listed here.
You tin can also go to Media > Add New directly and see the aforementioned message displayed at the bottom.
Once more, yous can see the 128 MB max upload file size here.
In the Site Health Info
WordPress 5.two added the Site Wellness Info tool to help you debug your WordPress site ameliorate. Here, you can find about all the information most your server and WordPress configuration.
Equally both the server and WordPress handle the max upload file size, there are 2 means to find its value on this screen.
First, you lot can find it listed under the Media Handling dropdown. Here, wait for the value of Max size of an uploaded file
constant.
The 2nd method is to look under the Server dropdown. You'll find many options related to your webserver's setup under here. Please search for the value for Upload max filesize
constant to meet what it is. On this site, the max upload file size limit is 128 MB.
Yous can also run across other PHP constants and their values, such every bit:
-
PHP post max size
: Defines the maximum upload limit for POST requests. -
PHP memory limit
: Defines the memory allocated for PHP. It should be set equal to or college than theUpload max filesize
limit. Or else the upload will fail.
Your web host sets these options. Usually, starter hosting plans volition take a lesser upload size limit than enterprise hosting plans. Some hosts may allow you lot to override these limits. But in most cases, you may need your hosting provider'south assistance (and possibly a programme upgrade) to increment them.
Why Increase the Maximum Upload File Size in WordPress?
At that place are many reasons why you may demand to increment your WordPress site'south maximum upload file size. Here are the most common ones:
- You want to install a large theme or plugin directly through the WordPress admin dashboard.
- Updating your WordPress site regularly is a groovy way to continue your readers engaged and return for more. And that includes uploading new images, videos, audios, and other media regularly. Withal, that's not always feasible when there'due south a file size limit for your uploads.
- You want to upload a large video or image as your site's groundwork or header.
- You lot plan to sell digital files such as ebooks, photographs, videos, themes, and plugins direct from your site. Sometimes, these files can stitch to hundreds of megabytes (or more).
Now that we've covered the basics of max upload file size in WordPress, let'due south learn how to increase it.
10 Ways to Increase the Max Upload File Size in WordPress
At that place are many ways you lot can fix the WordPress maximum upload size result. We'll start with the easiest ones get-go, and and then nosotros'll motion on to the intermediate-level tutorials.
Contact Your Hosting Provider for Aid
If you're facing problems with uploading files and file size limits, reaching out to your hosting provider for assistance is one of the quickest solutions. Increasing the upload limit is a lilliputian task for tech support, and then most hosting companies can assistance you set up this result apace.
Tinkering with your server or site configuration files tin always be a challenge. Hence, we ever recommend you endeavor this method first.
If you're hosting your site with Kinsta, our knowledgeable support team is just a click away and available 24/vii. To go started, become to your MyKinsta dashboard and click the chat icon in the bottom correct corner.
We have representatives to assist y'all in many languages, including English language, Spanish, French, German language, Italian, and Portuguese.
Increase the Max Upload File Size in WordPress Multisite
If you're running a WordPress Multisite network, then you can modify the max upload file size for your network.
Outset, head to your Network Admin dashboard, and then get to Settings > Network Settings screen. Here, curlicue downward till you find the Upload Settings section. You'll find the Max upload file size
field in this area.
The default value of Max upload file size in a WordPress Multisite is 1500 KB (~one.5 MB). You lot can change this to a higher value and click the Save Changes push.
Note: Y'all cannot circumvent the server-level max upload size limit from here. If the limit y'all prepare hither is higher than the server's max upload size limit, the server volition ignore it. You can employ the methods described above to find your webserver's configuration.
Here, we've set the new max upload file size to 131072 KB (~128 MB).
You tin also limit the total size of files uploaded to an individual site in the Multisite network. Still, information technology's disabled by default.
Update Your '.htaccess' File
If your webserver runs on Apache, you lot can update your site'due south .htaccess file to increment the max upload size in WordPress. You can find your .htaccess file in the WordPress site's root directory.
As per PHP documentation, iii PHP directives are responsible for how WordPress handles uploads. They are:
-
upload_max_filesize
-
post_max_size
-
memory_limit
Nosotros've already discussed them in the Site Health Info section above. It would help if you modified these three directives' values to admit your file sizes. For instance, if the largest file you're planning to upload is 32 MB, we recommend the following settings:
-
upload_max_filesize = 32M
-
post_max_size = 64M
-
memory_limit = 128M
Discover, all the values use G instead of MB. That's how PHP handles its directives.
Uploads tin contain extra data in addition to the file itself. So, giving all other upload-related directives some breathing space is a good idea. You can read our in-depth tutorial on how to improve PHP memory limit in WordPress for more than information.
Access your .htaccess file via FTP/SFTP or your hosting provider's File Director.
Open the.htaccess file with a text editor or code editor, and and then add the following code:
php_value upload_max_filesize 32M php_value post_max_size 64M php_value memory_limit 128M php_value max_execution_time 300 php_value max_input_time 300
You tin notice two other PHP directives in the in a higher place code: max_execution_time
and max_input_time
. They define how long a server spends on a single PHP chore. The bigger your uploads, the bigger the fourth dimension spent will be. You lot need to set their values to a number that'due south appropriate for your employ instance.
Note: You may get a 500 Internal Server Error subsequently using the method above. Most likely, it's considering your server is running PHP in CGI mode. In such cases, you cannot use the above commands in your .htaccess file.
Create or Modify the 'php.ini' File
The php.ini file is where you define changes to your default PHP settings. Typically, it contains directives that define file timeouts, max upload size, and resource limits.
Using SSH or FTP, yous tin discover the php.ini file in your WordPress root directory. In some cases, you may not locate it in that location. Fret not! Y'all tin create a new file with the same name in your site'southward root directory.
With a lawmaking or text editor, add the following lawmaking to your existing or new php.ini file:
upload_max_filesize = 32M post_max_size = 64M memory_limit = 128M
Don't forget to relieve your file afterward making the changes. Some hosts don't allow you to alter PHP settings via this method. In such a case, you tin keep to effort the following solution instead.
Subscribe Now
Create or Modify the '.user.ini' File
If your hosting provider has locked down the global PHP settings, they may have configured the server to work with .user.ini files instead of php.ini files.
Similar php.ini and .htaccess files, yous can notice the .user.ini in your site's root directory. If you can't detect it, then you can create a new .user.ini file in the same location. Follow the same procedure described in the previous method to create a newphp.ini file.
Side by side, add the following code to your .user.ini file:
upload_max_filesize = 32M post_max_size = 64M memory_limit = 128M
Y'all'll notice that it's a repeat of the previous method, except with a unlike filename.
Change PHP Options via cPanel
If your hosting provider uses the cPanel dashboard to assistance y'all manage your server and site configuration, y'all can change the max upload file size through its interface.
To get started, become to your cPanel dashboard, and select the Select PHP Version under the Software section.
Here, y'all can change your server's current PHP version and enable/disable many PHP extensions. Click on the Options link in the navigation menu to get to the PHP Options panel.
Curl down here to modify the values of PHP directives such as upload_max_filesize
, post_max_size
, memory_limit
, max_execution_time
, and max_input_time
. The max values you can prepare here depend on your current hosting programme.
If you have any doubts almost these values, we suggest you contact your hosting provider. The latest cPanel dashboard saves changes automatically, so you don't take to click anything. Just if you're using an older cPanel version, brand certain to click the Save Changes push.
Increase the Max Upload File Size in Nginx
Nginx is another webserver like Apache, but it'southward too a lot more. Typically, Nginx can handle more concurrent requests than Apache, making it a lot faster. Kinsta uses Nginx to power its performance-optimized hosting solutions for WordPress.
If y'all're running your WordPress site on Nginx, y'all'll need to modify both your php.ini and nginx.conf files. We've dealt with the sometime file before. The latter i is called an Nginx config file.
On an Nginx server, you tin can find the php.ini file at /etc/php/vii.iv/fpm/php.ini
. Depending on which PHP version y'all've installed, the verbal path may vary slightly.
upload_max_filesize = 64M post_max_size = 128M
You don't take to set the memory_limit
in the in a higher place file equally Nginx handles it differently. For more, you can check out this Stack Overflow thread. Later saving your php.ini file, enable the changes by restarting PHP-FPM using the below code in your terminal:
sudo service php7.4-fpm restart
Again, the exact lawmaking may vary slightly depending on the PHP version installed on your server.
Next, utilise Nginx's client_max_body_size
directive to set the new max upload size limit. Yous need to declare this directive in the nginx.conf file, which you can find at /etc/nginx/nginx.conf
.
You can declare this directive inside the http {...}
cake, the server {...}
block, or the location {...}
block.
Setting information technology in the http block will affect all the sites/apps hosted on this server.
http { ... client_max_body_size 128M; }
Defining it in the server cake will only bear on a specific site/app hosted by this server.
server { ... client_max_body_size 128M; }
The location block just affects the specified directory (eastward.m. files, uploads) inside a site/app.
location /files { ... client_max_body_size 128M; }
Don't forget to save the file and restart Nginx to use the changes. To do that, you can utilise the post-obit control in your terminal:
sudo service nginx reload
If you lot're a Kinsta client, you can't access your Nginx config directly. Even so, you can reach out to our support team, and they can quickly make the changes for you lot.
Utilise the WordPress 'upload_size_limit' Filter
WordPress 2.5 introduced the upload_size_limit filter, which filters the maximum upload size immune in php.ini. Even WordPress uses this filter to show you the max upload size allowed, like in the Media Library and Site Health Info screens.
Below is an instance of this filter in activity from WordPress contributor Drew Jaynes. Information technology defines the upload size limit for all non-admin roles.
/** * Filter the upload size limit for non-administrators. * * @param string $size Upload size limit (in bytes). * @render int (maybe) Filtered size limit. */ function filter_site_upload_size_limit( $size ) { // Set the upload size limit to ten MB for users lacking the 'manage_options' capability. if ( ! current_user_can( 'manage_options' ) ) { // ten MB. $size = 1024 * 10000; } return $size; } add_filter( 'upload_size_limit', 'filter_site_upload_size_limit', 20 );
The above code uses WordPress' manage_options
capability to gear up this limit only for non-admins. You can modify the code to target specific user roles or user ids. Read our in-depth WordPress roles and capabilities article for more than information.
Use a WordPress Plugin
Messing with code using SSH or FTP/SFTP is non for everyone. If you're not comfortable with writing or editing code, y'all can utilise a WordPress plugin instead.
We'll be using the WP Maximum Upload File Size plugin here. Equally of writing this, it'south the only upwards-to-engagement plugin on the WordPress plugin repository that helps you lot get this done.
To get started, install and activate the WP Maximum Upload File Size plugin. Next, go to its settings screen in your WordPress dashboard. Here, you can see the maximum upload file size set by both your hosting provider and WordPress.
Here, you can see that the maximum upload file size set past WordPress is lesser than that prepare by your hosting provider. Hence, you lot tin crank it up by choosing the Maximum Upload File Size with the dropdown presented.
Annotation: If you want to fix a max upload file size limit that'due south larger than the one set by your hosting provider, it's not possible to exercise it via this plugin. For that, yous demand to contact your hosting provider.
Upload Files via FTP/SFTP
Are you still struggling with all the above methods? Or with your hosting provider to accept them raise the upload file size limit? You can always upload large files via FTP/SFTP.
If you have a lot of large files to upload, this is the fastest method. You can read our in-depth tutorial on how to bulk upload files to the WordPress media library for more information.
Sometimes, WordPress doesn't recognize files uploaded via FTP/SFTP. If that'south the example, you can use the costless Add together From Server plugin to import the uploaded files into WordPress.
Alternatively, you tin can do the aforementioned straight from the command line by importing images using WP-CLI. The wp media import
command allows yous to create attachments from local files or URLs.
Don't Edit the 'wp-config.php' File
Editing the wp-config.php file doesn't work anymore. We're calculation it here considering we've constitute many web tutorials that list it as a legitimate way to increase the max upload size in WordPress.
It involves going to your site's root directory via FTP/SFTP or SSH and then editing the wp-config.php file.
You're suggested to add together the following code to the wp-config.php file:
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '128M'); @ini_set( 'memory_limit', '256M' );
Information technology fails to work because you can only use the ini_set() function to set PHP directives that vest to the PHP_INI_ALL changeable way.
As upload_max_size
and post_max_size
belong to the PHP_INI_PERDIR changeable manner. You can just fix them via php.ini, .htaccess, http.conf, or .user.ini.
If y'all've tried this method earlier without seeing whatever results, now yous know why it fails.
Verify Your WordPress Site's New Max Upload File Size
Finally, information technology'southward time to verify whether the new max upload file size limit is implemented in your WordPress site. To practise this, follow the same process we discussed higher up to check the max upload file size in WordPress.
Go to your Media Library in the WordPress dashboard and check whether the max upload file size limit has inverse.
Aye, it has changed. That's a success!
You can also go to the Site Health Info panel and bank check for the aforementioned nether Media Handling and Server dropdowns.
Summary
As y'all've seen, increasing the maximum upload file size in WordPress isn't too circuitous. Whether you're edifice a media-heavy portfolio site or installing a large theme, it's just a affair of knowing where to look for and what commands or tools to employ.
In nigh cases, reaching out to your hosting provider should be enough. However, if you're stuck with a troublesome host, we've shown you lot some culling methods you can try before migrating to ameliorate hosting.
Get uploading!
Did we embrace it all? If you've experienced a stubborn case of upload file size limits, let united states know how you managed to fix it.
Save time, costs and maximize site performance with:
- Instant help from WordPress hosting experts, 24/7.
- Cloudflare Enterprise integration.
- Global audition accomplish with 29 data centers worldwide.
- Optimization with our built-in Application Performance Monitoring.
All of that and much more than, in one plan with no long-term contracts, assisted migrations, and a 30-solar day-money-back-guarantee. Cheque out our plans or talk to sales to find the program that's right for yous.
Source: https://kinsta.com/blog/increase-max-upload-size-wordpress/