How to Test Server File Upload Limit
A low WordPress upload size limit stops you from uploading large files, plugins, and themes. If you're building a media-heavy website, that can exist a considerable obstacle. It'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, there are many ways to go about solving this issue. We'll cover them all in this article and show you lot how to increase the maximum upload size in WordPress quickly.
Let's dive in!
Prefer 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 prevent 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 also includes constants that ascertain this limit, but they cannot override the server-level settings in nearly cases.
To verify this, go to your WordPress site'due south Media Library. Here, effort 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, merely it exists for two master reasons: security and efficiency. It hinders site owners and other users, including malicious actors, from uploading huge files (e.g. loftier-resolution images, large videos).
Otherwise, it can result in incapacitating your website's server, making your site come to a crawl. Or worse, it tin bring your site down altogether!
How to Bank check the Current Maximum Upload Size in WordPress
In that location 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 in that location, go to Media > Library. Here, click on the Add New push button to activate the media uploader tool.
Equally Kinsta hosts this site, the Maximum upload file size: 128 MB. message displays below the Select Files push button. If yous're using a different spider web hosting provider, you may come across a dissimilar limit listed here.
You can besides go to Media > Add New directly and see the same message displayed at the lesser.
Again, you can encounter the 128 MB max upload file size here.
In the Site Health Info
WordPress five.two added the Site Health Info tool to assistance you lot debug your WordPress site better. Hither, you can find nearly all the information nigh your server and WordPress configuration.
Every bit both the server and WordPress handle the max upload file size, in that location are two ways to find its value on this screen.
Kickoff, you can notice information technology listed nether the Media Treatment dropdown. Here, look for the value of Max size of an uploaded file constant.
The 2nd method is to look nether the Server dropdown. You'll observe many options related to your webserver's setup under here. Please search for the value for Upload max filesize constant to encounter what it is. On this site, the max upload file size limit is 128 MB.
You lot can also see other PHP constants and their values, such as:
-
PHP post max size: Defines the maximum upload limit for POST requests. -
PHP retentivity limit: Defines the retentivity allocated for PHP. It should be prepare equal to or higher than theUpload max filesizelimit. Or else the upload will fail.
Your spider web host sets these options. Commonly, starter hosting plans volition have a lesser upload size limit than enterprise hosting plans. Some hosts may allow you to override these limits. But in nigh cases, you may need your hosting provider'southward aid (and perhaps a plan upgrade) to increase them.
Why Increase the Maximum Upload File Size in WordPress?
At that place are many reasons why yous may need to increase your WordPress site's maximum upload file size. Here are the most common ones:
- You desire to install a large theme or plugin directly through the WordPress admin dashboard.
- Updating your WordPress site regularly is a nifty style to keep your readers engaged and return for more. And that includes uploading new images, videos, audios, and other media regularly. Notwithstanding, that'southward not ever viable when there'southward a file size limit for your uploads.
- You want to upload a big video or image as your site'due south background or header.
- You plan to sell digital files such equally ebooks, photographs, videos, themes, and plugins directly from your site. Sometimes, these files can run up to hundreds of megabytes (or more than).
Now that we've covered the nuts of max upload file size in WordPress, let's learn how to increment it.
10 Ways to Increase the Max Upload File Size in WordPress
At that place are many means you tin gear up the WordPress maximum upload size consequence. Nosotros'll start with the easiest ones showtime, and and then we'll move on to the intermediate-level tutorials.
Contact Your Hosting Provider for Help
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 trivial task for tech back up, so most hosting companies tin assistance you lot prepare this event quickly.
Tinkering with your server or site configuration files can always be a challenge. Hence, we always recommend y'all effort this method first.
If y'all're hosting your site with Kinsta, our knowledgeable support squad is merely a click away and available 24/7. To get started, go to your MyKinsta dashboard and click the chat icon in the lesser right corner.
We have representatives to assist you in many languages, including English language, Spanish, French, German, Italian, and Portuguese.
Increase the Max Upload File Size in WordPress Multisite
If you're running a WordPress Multisite network, then y'all can alter the max upload file size for your network.
Starting time, caput to your Network Admin dashboard, and then go to Settings > Network Settings screen. Here, scroll downwardly till you find the Upload Settings department. You'll find the Max upload file size field in this expanse.
The default value of Max upload file size in a WordPress Multisite is 1500 KB (~1.five MB). You tin alter this to a higher value and click the Relieve Changes button.
Notation: Yous cannot circumvent the server-level max upload size limit from here. If the limit you set hither is college than the server'southward max upload size limit, the server will ignore it. You can employ the methods described above to find your webserver's configuration.
Here, nosotros've fix the new max upload file size to 131072 KB (~128 MB).
Yous can likewise limit the total size of files uploaded to an individual site in the Multisite network. Still, it'due south disabled by default.
Update Your '.htaccess' File
If your webserver runs on Apache, you tin can update your site's .htaccess file to increase the max upload size in WordPress. You tin observe your .htaccess file in the WordPress site's root directory.
As per PHP documentation, three 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 higher up. Information technology would help if yous modified these 3 directives' values to acknowledge your file sizes. For instance, if the largest file you're planning to upload is 32 MB, we recommend the post-obit settings:
-
upload_max_filesize = 32M -
post_max_size = 64M -
memory_limit = 128M
Notice, all the values use Chiliad instead of MB. That's how PHP handles its directives.
Uploads can incorporate actress information in addition to the file itself. So, giving all other upload-related directives some breathing infinite is a good idea. You can read our in-depth tutorial on how to improve PHP memory limit in WordPress for more than data.
Access your .htaccess file via FTP/SFTP or your hosting provider's File Manager.
Open the.htaccess file with a text editor or code editor, and and then add the post-obit 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 can notice two 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 task. The bigger your uploads, the bigger the time spent volition be. You need to set their values to a number that'due south advisable for your use case.
Note: Yous may get a 500 Internal Server Error subsequently using the method above. Most likely, it's because your server is running PHP in CGI mode. In such cases, y'all cannot use the higher up commands in your .htaccess file.
Create or Modify the 'php.ini' File
The php.ini file is where y'all 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, y'all tin find the php.ini file in your WordPress root directory. In some cases, you may not locate information technology at that place. Fret not! You can create a new file with the same name in your site's root directory.
With a lawmaking 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 change PHP settings via this method. In such a case, you can go on to try the following solution instead.
Subscribe At present
Create or Change the '.user.ini' File
If your hosting provider has locked down the global PHP settings, they may take configured the server to piece of work with .user.ini files instead of php.ini files.
Like php.ini and .htaccess files, you tin observe the .user.ini in your site's root directory. If you can't find information technology, and 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 post-obit lawmaking to your .user.ini file:
upload_max_filesize = 32M post_max_size = 64M memory_limit = 128M Yous'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 help you manage your server and site configuration, you tin change the max upload file size through its interface.
To get started, go to your cPanel dashboard, and select the Select PHP Version nether the Software section.
Hither, you can modify your server'south 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.
Curl downwards 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 lot tin can set here depend on your electric current hosting plan.
If you have any doubts most these values, we suggest you contact your hosting provider. The latest cPanel dashboard saves changes automatically, and then you lot don't have to click anything. But if y'all're using an older cPanel version, make sure to click the Salve Changes push.
Increase the Max Upload File Size in Nginx
Nginx is some other webserver like Apache, merely it's also 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 you're running your WordPress site on Nginx, you'll need to alter both your php.ini and nginx.conf files. We've dealt with the sometime file before. The latter one is chosen an Nginx config file.
On an Nginx server, you can find the php.ini file at /etc/php/seven.4/fpm/php.ini . Depending on which PHP version you've installed, the verbal path may vary slightly.
upload_max_filesize = 64M post_max_size = 128M Yous don't have to set up the memory_limit in the above file as Nginx handles it differently. For more, yous can cheque out this Stack Overflow thread. Afterwards saving your php.ini file, enable the changes by restarting PHP-FPM using the below code in your terminal:
sudo service php7.four-fpm restart Again, the exact lawmaking may vary slightly depending on the PHP version installed on your server.
Adjacent, use Nginx's client_max_body_size directive to ready the new max upload size limit. You demand to declare this directive in the nginx.conf file, which you can discover at /etc/nginx/nginx.conf .
You lot can declare this directive inside the http {...} cake, the server {...} block, or the location {...} cake.
Setting it in the http block volition affect all the sites/apps hosted on this server.
http { ... client_max_body_size 128M; } Defining it in the server block will only affect a specific site/app hosted by this server.
server { ... client_max_body_size 128M; } The location block only affects the specified directory (e.thousand. files, uploads) inside a site/app.
location /files { ... client_max_body_size 128M; } Don't forget to save the file and restart Nginx to apply the changes. To exercise that, you can use the following control in your terminal:
sudo service nginx reload If you're a Kinsta client, you tin can't access your Nginx config directly. Nevertheless, you can attain out to our back up team, and they can quickly make the changes for y'all.
Use 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 testify you the max upload size allowed, like in the Media Library and Site Health Info screens.
Below is an example of this filter in activity from WordPress contributor Drew Jaynes. Information technology defines the upload size limit for all not-admin roles.
/** * Filter the upload size limit for non-administrators. * * @param cord $size Upload size limit (in bytes). * @return int (maybe) Filtered size limit. */ part filter_site_upload_size_limit( $size ) { // Set 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 lawmaking uses WordPress' manage_options adequacy to prepare this limit only for non-admins. You lot tin modify the code to target specific user roles or user ids. Read our in-depth WordPress roles and capabilities article for more information.
Employ a WordPress Plugin
Messing with lawmaking using SSH or FTP/SFTP is not for everyone. If you lot're not comfortable with writing or editing code, you can use a WordPress plugin instead.
Nosotros'll exist using the WP Maximum Upload File Size plugin here. As of writing this, it'due south the just up-to-date plugin on the WordPress plugin repository that helps you get this washed.
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.
Hither, y'all can run into that the maximum upload file size set by WordPress is lesser 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 yous desire to set a max upload file size limit that's larger than the 1 ready past your hosting provider, information technology'south not possible to do it via this plugin. For that, you need to contact your hosting provider.
Upload Files via FTP/SFTP
Are yous still 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 can read our in-depth tutorial on how to majority upload files to the WordPress media library for more data.
Sometimes, WordPress doesn't recognize files uploaded via FTP/SFTP. If that's the example, you can utilise the gratis Add From Server plugin to import the uploaded files into WordPress.
Alternatively, you lot tin practice the aforementioned directly from the command line by importing images using WP-CLI. The wp media import command allows you 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 adding it hither considering we've found many web tutorials that list it equally a legitimate way to increase the max upload size in WordPress.
It involves going to your site'southward root directory via FTP/SFTP or SSH and so editing the wp-config.php file.
You're suggested to add the post-obit lawmaking 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 piece of work because you can merely use the ini_set() role to set up PHP directives that vest to the PHP_INI_ALL changeable mode.
As upload_max_size and post_max_size vest to the PHP_INI_PERDIR changeable manner. You tin only prepare them via php.ini, .htaccess, http.conf, or .user.ini.
If you've tried this method before without seeing any results, now you know why information technology fails.
Verify Your WordPress Site'due south New Max Upload File Size
Finally, it'southward time to verify whether the new max upload file size limit is implemented in your WordPress site. To practice this, follow the aforementioned procedure we discussed in a higher place to check the max upload file size in WordPress.
Go to your Media Library in the WordPress dashboard and cheque whether the max upload file size limit has changed.
Yes, it has inverse. That's a success!
You can besides become to the Site Wellness Info panel and cheque for the same under Media Handling and Server dropdowns.
Summary
Equally you've seen, increasing the maximum upload file size in WordPress isn't also complex. Whether you're building a media-heavy portfolio site or installing a large theme, it's just a thing of knowing where to expect for and what commands or tools to use.
In most cases, reaching out to your hosting provider should be enough. Even so, if you're stuck with a troublesome host, we've shown you some alternative methods you can try before migrating to better hosting.
Become uploading!
Did nosotros cover it all? If you've experienced a stubborn case of upload file size limits, let usa know how you managed to prepare it.
Save time, costs and maximize site operation with:
- Instant help from WordPress hosting experts, 24/7.
- Cloudflare Enterprise integration.
- Global audience achieve with 29 data centers worldwide.
- Optimization with our built-in Application Functioning Monitoring.
All of that and much more, in one plan with no long-term contracts, assisted migrations, and a xxx-solar day-coin-dorsum-guarantee. Check out our plans or talk to sales to find the plan that's correct for you.
Source: https://kinsta.com/blog/increase-max-upload-size-wordpress/
0 Response to "How to Test Server File Upload Limit"
Post a Comment