Limit File Upload Size in Thin Server
A low WordPress upload size limit stops you from uploading large files, plugins, and themes. If yous're edifice a media-heavy website, that can exist a considerable obstacle. It'southward necessary to increment the max upload size in WordPress or your server (or both) in such cases.
Depending on your hosting provider and server, there are many means to go about solving this issue. Nosotros'll cover them all in this article and show you how to increase the maximum upload size in WordPress speedily.
Let'southward swoop in!
Prefer to lookout man the video version?
What Is the Maximum Upload Size in WordPress?
Uploading big files to a server consumes a lot of the server'south resources. To foreclose users from causing server timeouts, the default maximum upload size in WordPress typically ranges from iv MB to 128 MB. Unremarkably, the hosting provider sets this limit at the server level.
WordPress also includes constants that define this limit, but they cannot override the server-level settings in nearly cases.
To verify this, go to your WordPress site'south Media Library. Here, try to upload a file that crosses this maximum upload file size limit. You'll see an fault bulletin that looks something like this:

The "exceeds the maximum upload size for this site" fault tin be frustrating, simply information technology exists for 2 chief reasons: security and efficiency. It hinders site owners and other users, including malicious actors, from uploading huge files (eastward.thousand. high-resolution images, big videos).
Otherwise, information technology can result in incapacitating your website's server, making your site come to a crawl. Or worse, it can bring your site downwardly altogether!
How to Check the Current Maximum Upload Size in WordPress
There are many ways to bank check your WordPress site's current max upload size. Permit's get through all of them.
In the Media Library
The quickest way to check your site's electric current maximum upload size is to go to your WordPress dashboard, and from there, go to Media > Library. Hither, click on the Add New button to activate the media uploader tool.

Every bit Kinsta hosts this site, the Maximum upload file size: 128 MB.
bulletin displays below the Select Files button. If yous're using a dissimilar web hosting provider, you may see a different limit listed here.
Y'all can likewise go to Media > Add New directly and run into the same message displayed at the bottom.

Over again, yous can run into the 128 MB max upload file size here.
In the Site Wellness Info
WordPress 5.2 added the Site Health Info tool to assist y'all debug your WordPress site amend. Hither, you can notice almost all the data virtually your server and WordPress configuration.
As both the server and WordPress handle the max upload file size, there are two ways to discover its value on this screen.
First, yous can observe it listed under the Media Handling dropdown. Here, look for the value of Max size of an uploaded file
constant.

The second method is to look under the Server dropdown. You'll detect many options related to your webserver'south setup under hither. Please search for the value for Upload max filesize
constant to come across what information technology is. On this site, the max upload file size limit is 128 MB.

Yous can also see other PHP constants and their values, such as:
-
PHP postal service max size
: Defines the maximum upload limit for POST requests. -
PHP memory limit
: Defines the memory allocated for PHP. It should be ready equal to or higher than theUpload max filesize
limit. Or else the upload will fail.
Your web host sets these options. Unremarkably, starter hosting plans will accept a lesser upload size limit than enterprise hosting plans. Some hosts may permit you lot to override these limits. But in about cases, you lot may need your hosting provider's assist (and perhaps a plan upgrade) to increment them.
Why Increment the Maximum Upload File Size in WordPress?
In that location are many reasons why y'all may need to increase your WordPress site's maximum upload file size. Here are the near common ones:
- Yous want to install a big theme or plugin directly through the WordPress admin dashboard.
- Updating your WordPress site regularly is a corking way to keep your readers engaged and render for more. And that includes uploading new images, videos, audios, and other media regularly. However, that'southward not always feasible when there'south a file size limit for your uploads.
- You want to upload a large video or image equally your site's groundwork or header.
- You plan to sell digital files such as ebooks, photographs, videos, themes, and plugins directly from your site. Sometimes, these files can stitch to hundreds of megabytes (or more).
Now that nosotros've covered the basics of max upload file size in WordPress, allow's learn how to increment information technology.
10 Ways to Increment the Max Upload File Size in WordPress
There are many ways yous can prepare the WordPress maximum upload size issue. Nosotros'll first with the easiest ones first, and and then we'll movement on to the intermediate-level tutorials.
Contact Your Hosting Provider for Aid
If you're facing issues with uploading files and file size limits, reaching out to your hosting provider for aid is one of the quickest solutions. Increasing the upload limit is a fiddling task for tech support, and then most hosting companies can help yous fix this event quickly.
Tinkering with your server or site configuration files tin always be a challenge. Hence, we always recommend you try this method first.
If you're hosting your site with Kinsta, our knowledgeable support team is just a click abroad and available 24/seven. To get started, go to your MyKinsta dashboard and click the chat icon in the bottom correct corner.

Nosotros accept representatives to assist yous in many languages, including English language, Spanish, French, German, Italian, and Portuguese.
Increment the Max Upload File Size in WordPress Multisite
If yous're running a WordPress Multisite network, and so you can modify the max upload file size for your network.
First, caput to your Network Admin dashboard, so go to Settings > Network Settings screen. Here, roll downwardly till you find the Upload Settings section. You'll detect the Max upload file size
field in this area.

The default value of Max upload file size in a WordPress Multisite is 1500 KB (~1.5 MB). You can change this to a college value and click the Salvage Changes push.
Annotation: You cannot circumvent the server-level max upload size limit from here. If the limit you lot set here is higher than the server's max upload size limit, the server volition ignore it. You can employ the methods described above to observe your webserver's configuration.

Hither, we've ready the new max upload file size to 131072 KB (~128 MB).
You lot can also limit the total size of files uploaded to an private site in the Multisite network. However, it's disabled by default.
Update Your '.htaccess' File
If your webserver runs on Apache, you can update your site's .htaccess file to increase the max upload size in WordPress. You lot can find your .htaccess file in the WordPress site'southward root directory.
As per PHP documentation, 3 PHP directives are responsible for how WordPress handles uploads. They are:
-
upload_max_filesize
-
post_max_size
-
memory_limit
We've already discussed them in the Site Health Info section to a higher place. It would help if you modified these 3 directives' values to admit your file sizes. For instance, if the largest file you lot're planning to upload is 32 MB, nosotros recommend the post-obit settings:
-
upload_max_filesize = 32M
-
post_max_size = 64M
-
memory_limit = 128M
Discover, all the values employ Thou instead of MB. That's how PHP handles its directives.
Uploads can comprise extra data in addition to the file itself. So, giving all other upload-related directives some animate space is a good idea. Y'all can read our in-depth tutorial on how to improve PHP retention limit in WordPress for more than information.
Access your .htaccess file via FTP/SFTP or your hosting provider'south File Manager.

Open the.htaccess file with a text editor or code editor, and then add the following lawmaking:
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 can notice 2 other PHP directives in the to a higher place code: max_execution_time
and max_input_time
. They define how long a server spends on a single PHP job. The bigger your uploads, the bigger the time spent volition be. You lot need to set up their values to a number that'south appropriate for your apply example.
Note: You lot may go a 500 Internal Server Fault later using the method above. Most likely, it's because 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 ascertain changes to your default PHP settings. Typically, information technology contains directives that define file timeouts, max upload size, and resource limits.
Using SSH or FTP, you lot can find the php.ini file in your WordPress root directory. In some cases, you may not locate it there. Fret not! Y'all can create a new file with the aforementioned name in your site's root directory.

With a code or text editor, add the following code to your existing or new php.ini file:
upload_max_filesize = 32M post_max_size = 64M memory_limit = 128M
Don't forget to save your file subsequently making the changes. Some hosts don't allow you to modify PHP settings via this method. In such a case, y'all tin proceed to try the post-obit 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 piece of work with .user.ini files instead of php.ini files.
Similar php.ini and .htaccess files, you can discover the .user.ini in your site'due south root directory. If you tin't discover it, then you tin 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.
Next, add together the following code to your .user.ini file:
upload_max_filesize = 32M post_max_size = 64M memory_limit = 128M
You'll notice that information technology's a repeat of the previous method, except with a different filename.
Alter PHP Options via cPanel
If your hosting provider uses the cPanel dashboard to aid you manage your server and site configuration, you can change the max upload file size through its interface.
To go started, go to your cPanel dashboard, and select the Select PHP Version under the Software section.

Here, yous can change your server's current PHP version and enable/disable many PHP extensions. Click on the Options link in the navigation menu to go to the PHP Options panel.

Roll down here to change 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 lot can gear up here depend on your current hosting program.

If yous take any doubts about these values, we suggest yous contact your hosting provider. The latest cPanel dashboard saves changes automatically, so you don't have to click anything. But if you lot're using an older cPanel version, make sure to click the Save Changes button.
Increase the Max Upload File Size in Nginx
Nginx is some other webserver like Apache, but information technology'due south likewise a lot more. Typically, Nginx can handle more concurrent requests than Apache, making it a lot faster. Kinsta uses Nginx to ability its performance-optimized hosting solutions for WordPress.
If you're running your WordPress site on Nginx, y'all'll need to change both your php.ini and nginx.conf files. We've dealt with the former file before. The latter one is called an Nginx config file.
On an Nginx server, y'all can discover the php.ini file at /etc/php/7.4/fpm/php.ini
. Depending on which PHP version you've installed, the exact path may vary slightly.
upload_max_filesize = 64M post_max_size = 128M
You don't have to set the memory_limit
in the in a higher place file as Nginx handles it differently. For more, you tin can bank check out this Stack Overflow thread. After saving your php.ini file, enable the changes by restarting PHP-FPM using the beneath lawmaking in your terminal:
sudo service php7.4-fpm restart
Again, the exact code may vary slightly depending on the PHP version installed on your server.
Next, employ Nginx's client_max_body_size
directive to prepare the new max upload size limit. Y'all need to declare this directive in the nginx.conf file, which yous can find at /etc/nginx/nginx.conf
.
You tin declare this directive inside the http {...}
block, the server {...}
block, or the location {...}
block.
Setting it 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 block will simply affect a specific site/app hosted by this server.
server { ... client_max_body_size 128M; }
The location block merely affects the specified directory (e.thousand. files, uploads) inside a site/app.
location /files { ... client_max_body_size 128M; }
Don't forget to relieve the file and restart Nginx to utilize the changes. To do that, you can use the following command in your final:
sudo service nginx reload
If you're a Kinsta client, you lot can't access your Nginx config directly. However, you lot tin achieve out to our support team, and they tin can quickly make the changes for y'all.
Use the WordPress 'upload_size_limit' Filter
WordPress 2.v introduced the upload_size_limit filter, which filters the maximum upload size immune in php.ini. Fifty-fifty WordPress uses this filter to testify you the max upload size allowed, similar in the Media Library and Site Wellness Info screens.
Beneath is an case of this filter in action from WordPress contributor Drew Jaynes. It defines the upload size limit for all not-admin roles.
/** * Filter the upload size limit for not-administrators. * * @param string $size Upload size limit (in bytes). * @return int (perchance) Filtered size limit. */ function filter_site_upload_size_limit( $size ) { // Fix the upload size limit to 10 MB for users lacking the 'manage_options' adequacy. if ( ! current_user_can( 'manage_options' ) ) { // 10 MB. $size = 1024 * 10000; } return $size; } add_filter( 'upload_size_limit', 'filter_site_upload_size_limit', 20 );
The above code uses WordPress' manage_options
adequacy to set this limit merely for non-admins. Yous can alter the code to target specific user roles or user ids. Read our in-depth WordPress roles and capabilities article for more information.
Use a WordPress Plugin
Messing with lawmaking using SSH or FTP/SFTP is not for everyone. If you're not comfy with writing or editing lawmaking, you can utilise a WordPress plugin instead.

We'll exist using the WP Maximum Upload File Size plugin here. As of writing this, it's the only up-to-appointment plugin on the WordPress plugin repository that helps yous go this done.
To get started, install and activate the WP Maximum Upload File Size plugin. Side by side, get to its settings screen in your WordPress dashboard. Hither, you tin see the maximum upload file size gear up past both your hosting provider and WordPress.

Here, you lot tin see that the maximum upload file size set past WordPress is bottom than that set by your hosting provider. Hence, you can crank information technology up by choosing the Maximum Upload File Size with the dropdown presented.
Note: If you want to prepare a max upload file size limit that's larger than the one set up by your hosting provider, it'southward not possible to do it via this plugin. For that, you demand to contact your hosting provider.
Upload Files via FTP/SFTP
Are yous yet struggling with all the in a higher place methods? Or with your hosting provider to have them raise the upload file size limit? You can always upload large files via FTP/SFTP.

If you accept a lot of large files to upload, this is the fastest method. You lot can read our in-depth tutorial on how to majority 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 tin use the complimentary Add From Server plugin to import the uploaded files into WordPress.
Alternatively, you can practise the same directly 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 hither considering we've found many web tutorials that list information technology 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 and then editing the wp-config.php file.

You're suggested to add together the post-obit 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 considering yous can only utilize the ini_set() function to ready PHP directives that belong to the PHP_INI_ALL changeable way.
As upload_max_size
and post_max_size
belong to the PHP_INI_PERDIR changeable mode. You can but set up them via php.ini, .htaccess, http.conf, or .user.ini.
If you've tried this method before without seeing whatever results, now y'all know why it fails.
Verify Your WordPress Site's New Max Upload File Size
Finally, information technology's time to verify whether the new max upload file size limit is implemented in your WordPress site. To practise this, follow the aforementioned procedure we discussed above to bank check the max upload file size in WordPress.
Become to your Media Library in the WordPress dashboard and check whether the max upload file size limit has changed.

Yes, information technology has changed. That's a success!
You lot can also go to the Site Health Info console and check for the same under Media Treatment and Server dropdowns.


Summary
Every bit you've seen, increasing the maximum upload file size in WordPress isn't likewise circuitous. Whether y'all're edifice a media-heavy portfolio site or installing a large theme, information technology's just a matter of knowing where to await for and what commands or tools to employ.
In most cases, reaching out to your hosting provider should be plenty. However, if you're stuck with a troublesome host, we've shown you lot some alternative methods you lot tin can try before migrating to better hosting.
Get uploading!
Did we comprehend information technology all? If you've experienced a stubborn instance of upload file size limits, let us know how you lot managed to fix it.
Relieve time, costs and maximize site performance with:
- Instant assist from WordPress hosting experts, 24/seven.
- Cloudflare Enterprise integration.
- Global audience reach with 29 data centers worldwide.
- Optimization with our congenital-in Application Functioning Monitoring.
All of that and much more than, in one plan with no long-term contracts, assisted migrations, and a xxx-mean solar day-money-dorsum-guarantee. Check out our plans or talk to sales to notice the plan that'southward correct for you.
carpentervidereps.blogspot.com
Source: https://kinsta.com/blog/increase-max-upload-size-wordpress/
Post a Comment for "Limit File Upload Size in Thin Server"