Article
How to increase the maximum upload file size in WordPress?
Are you tired of the frustratingly low upload size limit in your WordPress website? I have some amazing tips for you to increase your max upload size and take your website to the next level! Keep reading to find out the secrets to maximizing your WordPress potential.
What Is the Maximum Upload Size in WordPress?
When you want to upload a big file to a website, it can take up a lot of the website's resources. To make sure that the website doesn't crash when this happens, there is usually a limit on how big the file can be. For most WordPress websites, this limit is between 4 MB and 128 MB. The hosting company that runs the website sets this limit.
Sometimes, there are settings in WordPress that can change this limit, but usually, they can't override the limit set by the hosting company. At Kinsta, one hosting company, the maximum file size you can upload is 128 MB.
To check what the limit is on your WordPress website, you can go to the Media Library and try to upload a file that is bigger than the limit. If you get an error message that says you can't upload the file, that means you've hit the limit.
Getting an error message that says “exceeds the maximum upload size for this site” can be a real pain. But the reason for this limit is actually a good one: it helps keep the site secure and running smoothly. If people were allowed to upload huge files, like very large photos or videos, it could cause big problems for the site. It might slow it down so much that it becomes almost unusable, or even crash the whole site! So, while it might be frustrating, it's important to keep to the upload limits to keep the site safe and working well.
How to Check the Current Maximum Upload Size in WordPress?
There are multiple ways to check the maximum upload size of your WordPress website. Let's explore them all.
In the Media Library
If you have a website, you might sometimes need to upload large files on it. However, every website has a maximum upload size limit that you can’t exceed. So, if you want to know how much you can upload, here’s how to check it.
First, go to your website’s dashboard, and then click on the “Media” option. From there, click on the “Library” option. Once you’re there, you’ll see a button that says “Add New” – click on it.
If your website is hosted by Kinsta, you’ll see a message that says “Maximum upload file size: 128 MB” beneath the “Select Files” button. However, if you’re on a different hosting provider, you might see a different message.
Alternatively, you can directly go to “Media” and then click on “Add New”. You’ll see the same message displayed at the bottom of the page.
So, that’s how you can quickly find out the maximum upload file size limit of your website.
In the Site Health Info
WordPress 5.2 has added a new feature called Site Health Info. This feature helps you to better understand your WordPress site and server configuration. It provides you with almost all the information about your server and WordPress settings, making it easier to debug any issues you might encounter with your website.
One of the things you can find using the Site Health Info tool is the maximum file size that you can upload to your WordPress site. There are two ways to find out this information using the tool. Firstly, you can look under the "Media Handling" dropdown, where you'll see the "Max size of an uploaded file" value listed.
Alternatively, you can look under the "Server" dropdown and find the "Upload max filesize" value. On our site, the limit is 128MB.
You might also see some other technical terms like "PHP post max size" and "PHP memory limit" under the Site Health Info tool. These define the maximum upload limit for POST requests and the memory allocated for PHP. If you want to upload files larger than the upload max filesize limit, you should ensure that the PHP memory limit is set equal to or higher than the upload max filesize limit. If it's not, then your upload will fail.
It's worth noting that these options are set by your web host, and different hosting plans may come with different limits. If you're on a starter hosting plan, you may have a lower upload size limit than you would on an enterprise hosting plan. Some hosts may allow you to override these limits, but in most cases, you'll need your hosting provider's help (and possibly an upgrade to your hosting plan) to increase them.
Why Increase the Maximum Upload File Size in WordPress?
If you're using WordPress, you may need to increase your maximum upload file size for several reasons. These are the most common ones:
You want to install a large theme or plugin directly through the WordPress admin dashboard.
Uploading new media such as images, videos, audios and other content is an excellent way to keep your readers engaged and coming back for more. However, there's a file size limit for your uploads that may prevent you from doing so regularly.
You want to use a large video or image as your site's background or header.
If you plan to sell digital files directly from your site, such as ebooks, photographs, videos, themes and plugins, these files can be very large, sometimes running up to hundreds of megabytes or more.
10 Ways to Increase the Max Upload File Size in WordPress
1. Contact Your Hosting Provider for Help
If you're having trouble uploading files to your website and are reaching file size limits, don't worry. One of the easiest ways to fix this is by contacting your website host provider for help. They can quickly increase the limit for you. Making changes to your website configuration files can be a bit tricky, so it's best to ask for help first.
If you're using Kinsta to host your website, their support team is always available to help you out 24/7. All you need to do is go to your MyKinsta dashboard and click on the chat icon in the bottom right corner.
Next click the Send us a message button and let us know how we can help:
We have representatives to assist you in many languages, including English, Spanish, French, German, Italian, and Portuguese.
2. Increase the Max Upload File Size in WordPress Multisite
If you use WordPress Multisite to run multiple websites, you might want to change the maximum file size you can upload to your network. The default maximum file size is around 1.5 MB, but you can increase it to a higher value.
To change the maximum file size, go to your Network Admin dashboard, and then click on Settings > Network Settings. Look for the Upload Settings section and you'll find the Max upload file size field.
Simply change the value to the desired amount and click the Save Changes button.
However, please note that you can't change the maximum file size limit set by your web server from here. If you set a higher limit than what your server can handle, the server will simply ignore it. To find out your server's configuration, you'll need to use other methods.
Also, keep in mind that you can limit the total size of files uploaded to an individual website in your Multisite network, but it's disabled by default.
3. Update Your ‘.htaccess’ File
If you're using WordPress to manage your website, you may face difficulty uploading large files. However, there's a way to increase the maximum file upload size. You can do this by changing some values in your site's configuration file, which is called .htaccess.
There are three values that you need to change in the configuration file: upload_max_filesize, post_max_size, and memory_limit. These determine how WordPress handles file uploads. If you want to upload a file that's up to 32 MB, you'll need to adjust these values accordingly. Here's what you need to do:
1. Access your website's configuration file (the .htaccess file) through FTP/SFTP or your hosting provider's File Manager.
2. Open the .htaccess file with a text editor or code editor.
3. Add the following code to the file:
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
4. Save the file and upload it back to the server.
Note that the values use "M" instead of "MB." This is how PHP handles its directives. Additionally, there are two other PHP directives in the code above: max_execution_time and max_input_time. These determine how long a server spends on a single PHP task. You'll need to adjust these values depending on the size of the file you want to upload.
One last thing to note: If your server is running PHP in CGI mode, you may encounter a 500 Internal Server Error after using the above method. In such cases, you cannot use the above commands in your .htaccess file.
4. Create or Modify the ‘php.ini’ File
The php.ini file is a special file that controls how your website works. It tells the website how to handle things like big files and how much memory it can use. If you want to change how your website handles those things, you need to edit php.ini.
To find this file, you can use a special tool called SSH or FTP. It's usually located in your website's main folder, but sometimes it might be somewhere else. If you can't find it, don't worry! You can create a new file with the same name.
Once you've found or created the file, you need to add some code to it. This code tells your website how to handle big files and how much memory it can use. Here's the code you need:
upload_max_filesize = 32M
post_max_size = 64M
memory_limit = 128M
After you've added the code, make sure you save the file. Sometimes, your web host might not let you change these settings. If that's the case, you can try another solution.
5. Create or Modify the ‘.user.ini’ File
If you're having trouble uploading files to your website, it might be because your hosting provider has some restrictions in place. But don't worry, there's a way to fix it! You can create a file called ".user.ini" in your site's main folder, and add some code to it. This will allow you to upload bigger files.
To create the file, you can follow the same steps you would use to create a "php.ini" file. Then, add this code to the new ".user.ini" file:
upload_max_filesize = 32M
post_max_size = 64M
memory_limit = 128M
This code will help you upload files up to 32 megabytes in size. You can adjust the numbers to match your specific needs. And that's it! With this simple fix, you can upload bigger files to your website without any issues.
6. Change PHP Options via cPanel
If you're trying to upload a file to your website and it's too big, don't worry! You can change the maximum file size allowed by your hosting provider.
To do this, you need to go to your website's control panel (which is called cPanel) and look for the option to change your PHP version. This might be in a section called "Software."
Once you find the option to change your PHP version, you can also change other settings that affect how your website works. Look for an option called "PHP Options" and scroll down until you see some settings that control things like how big a file you can upload.
If you're not sure what to change these settings to, you can ask your hosting provider for help. Once you're done making changes, don't forget to save them!
7. Increase the Max Upload File Size in Nginx
If you're running a website on Nginx, a webserver like Apache but faster, you might need to adjust your server settings to allow for larger file uploads. To do this, you need to modify two files, php.ini and nginx.conf, which control how your server handles PHP code and file uploads, respectively.
First, you need to edit the php.ini file to increase the maximum file upload size. You can find this file in the /etc/php/7.4/fpm/php.ini directory on your server. Look for the upload_max_filesize and post_max_size settings and increase their values to allow for larger file uploads. You don't need to change the memory_limit setting, as Nginx handles this differently.
Once you've made these changes, you need to restart PHP-FPM to apply them. You can do this by running the command "sudo service php7.4-fpm restart" in your terminal. If you're not sure which version of PHP you're using, the command might look slightly different.
Next, you need to adjust the client_max_body_size setting in your nginx.conf file to allow for larger file uploads. This setting controls the maximum size of files that your server will accept. You can find the nginx.conf file in the /etc/nginx/nginx.conf directory.
To increase the file upload size limit, you need to add the client_max_body_size directive to your nginx.conf file. You can add this directive to the http block to affect all the sites hosted on your server, or to the server block to affect a specific site. You can also add it to the location block to affect a specific directory within a site.
Once you've made these changes, you need to save the file and restart Nginx to apply them. You can do this by running the command "sudo service nginx reload" in your terminal.
If you're a Kinsta client, you can't access your Nginx config directly, but you can contact their support team for help making these changes.
8. Use the WordPress ‘upload_size_limit’ Filter
WordPress 2.5 introduced the upload_size_limit filter, which lets you filter the maximum upload size allowed in php.ini. Even WordPress uses this filter to show you the max upload size allowed, such as in the Media Library and Site Health Info screens.
For example, WordPress contributor Drew Jaynes defined the upload size limit for all non-admin roles using this filter. The following code snippet limits the upload size to 10 MB for users who lack the 'manage_options' capability:
function filter_site_upload_size_limit( $size ) {
if ( ! current_user_can( 'manage_options' ) ) {
$size = 1024 * 1024 * 10; // 10 MB.
}
return $size;
}
add_filter( 'upload_size_limit', 'filter_site_upload_size_limit', 20 );
You can modify the code to target specific user roles or user IDs. Refer to our in-depth WordPress roles and capabilities article for more information.
Note that this only works with the standard multi-file uploader. You may still see the upload limit shown in the text, but it only gets enforced when using the standard WordPress uploader.
9. Use a WordPress Plugin
If you're not comfortable with writing or editing code, you can use a WordPress plugin to adjust your website's maximum upload file size.
The WP Maximum Upload File Size plugin is the only up-to-date plugin on the WordPress plugin repository that can help you perform this task. To get started, install and activate the plugin, then navigate to its settings screen in your WordPress dashboard. Here, you can view the maximum upload file size set by both your hosting provider and WordPress.
If you want to increase the maximum upload file size, simply choose the desired size from the dropdown menu. Do note that if you wish to set a maximum upload file size limit that exceeds the limit set by your hosting provider, you will need to contact your hosting provider directly.
10. Upload Files via FTP/SFTP
Are you still struggling with all the above methods? Or with your hosting provider to have them raise the upload file size limit? You can always upload large files via FTP/SFTP.
Drag and drop files to and for your server and computer with 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’s the case, you can use the free Add From Server plugin to import the uploaded files into WordPress.
Alternatively, you can do the same straight 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.
Summary
As you might have noticed, it's possible to upload larger files on WordPress without much difficulty. Whether you're creating a website with lots of pictures and videos or adding a big design, it's all about knowing where to find and how to use the right tools and commands. In most cases, contacting your hosting provider is all you need to do. However, if you're having trouble with your current host, we've provided some other ways to try before switching to a better hosting service.