Struggling with how to increase the maximum file upload size in WordPress?
The default max upload size value depends on your host, but it can be quite low in some cases. This can result in you seeing errors such as “The uploaded file exceeds the upload_max_filesize directive in php.ini” when you try to upload files to your WordPress site’s Media Library or via other upload interfaces.
Thankfully, there are some fixes that you can apply to solve the problem.
In this post, we’ll show you several different methods that you can use to increase the maximum file upload size on your WordPress site.
Many of these methods will require adding some code snippets to your site. However, we will start with a simple plugin method that might work depending on how your server is configured.
Here are the five methods that we’ll cover:
Let’s get started!
Before getting started, here’s a quick way to check your WordPress site’s existing max file upload size.
In your WordPress dashboard, go to Media → Add New and look for the Maximum upload file size value:
If this value is smaller than the file you’re trying to upload, you now know why you’re having issues.
Before we get started, I want to note that whether or not some of these methods work depends on your host’s configuration. We cannot guarantee that all of the methods will work for your specific situation. But we can say that they work for many WordPress users and hosting configurations.
So, if you try these methods and find that they don’t work for you, your next step should be to reach out to your host’s support. They might be able to override whatever is causing the problem.
With that caveat out of the way, let’s get into the tutorials…
The absolute simplest option to increase your max upload size is to use the free Increase Maximum Upload File Size plugin because it doesn’t require editing any code.
However, the plugin will only work up to the maximum upload limit set by your server. For that reason, it will only fix the problem if the issue is that your WordPress site’s upload limit is set lower than the server upload limit for some reason.
To check if it will work for you, install and activate the free plugin from WordPress.org. Then, go to Settings → Increase Maximum Upload File Size.
You’ll see the max upload size from your server as well as your WordPress site’s current site limit. You can then use the drop-down to set your site’s max anywhere up to the server max:
If your server’s max upload size is still too low, keep reading for some code-based fixes for that.
In some situations, you can increase your max upload size by adding the following code snippets to either your child theme’s functions.php file or via the Code Snippets plugin (or another similar plugin).
If you’re adding it to functions.php, make sure to use a child theme. Otherwise, your changes will be overwritten when you update your theme.
@ini_set( 'upload_max_size' , '32M' );
@ini_set( 'post_max_size', '32M');
@ini_set( 'max_execution_time', '300' );
You can change the numbers – ’32M’ – according to your needs. For example, to make the max upload 64 MB, you could change it to ’64M’.
The php.ini file controls basic PHP configuration variables, including the max upload size.
At some hosts, you might be able to edit the php.ini file via cPanel, which is simpler than editing the file directly. For example, with Bluehost, you can open cPanel by clicking the Advanced tab in your Bluehost dashboard. Then, you can select the MultiPHP INI Editor tool:
Then, you can select the site that you want to edit and adjust the upload_max_filesize
directive:
If your host doesn’t offer such a tool, you can try accessing the file directly.
Connect to your server’s root folder using FTP or cPanel File Manager (the root folder is the same folder that contains the wp-config.php file):
Then, add the following lines of code:
upload_max_filesize = 32M
post_max_size = 32M
max_execution_time = 300
Or, if you already see those lines of code, edit the numbers according to your needs.
If your host uses the Apache web server (which most WordPress hosts do), you can try to increase your max upload size by editing your site’s .htaccess file.
To edit the .htaccess file, you’ll need to connect to your server using FTP or cPanel File Manager. Then, find the .htaccess file in the root folder (the same folder that contains wp-config.php).
Before making any edits, you should download a copy of the file to your local computer so that you have a safe backup in case something goes wrong (it’s unlikely – but the .htaccess file is sensitive so you always want to have a backup).
Once you have a backup, edit the file and add the following code:
php_value upload_max_filesize 32M
php_value post_max_size 32M
php_value max_execution_time 300
php_value max_input_time 300
Again, you can change the numbers according to your needs.
Again, we can’t guarantee that these methods will work for all sites because sometimes your host’s configuration just won’t allow these tactics to work.
So – if nothing has worked so far, we recommend that you reach out to your host’s support to see if they will increase your server’s upload limit for you.
If nothing has worked so far and your host won’t increase the max upload file size for you, I’ll finish by sharing a workaround that you can use to upload huge files to your WordPress Media Library.
This won’t permanently fix the problem, but it will give you a way to get the file uploaded right away, which might be exactly what you need right now.
Instead of trying to upload files via the WordPress dashboard, you can upload the file using FTP, which will completely bypass any file size limits.
To get started, use FTP to upload the file to the wp-content/uploads/…
folder, making sure to select the correct year/month.
For example:
/wp-content/uploads/2021/01/
Now, the file is on your server. However, WordPress won’t recognize it inside your Media Library yet. To fix that, you can use the free Add From Server plugin to register the file that you uploaded to your Media Library.
After activating the plugin, go to Media → Add From Server:
Then, open the folder where you uploaded the file via FTP and import the files that you uploaded:
Once you import the file using the plugin, you’ll see the file in your Media Library just as if you’d uploaded it directly via your WordPress dashboard.
For a deeper look at this method, check out our tutorial on how to bulk upload files to WordPress.
In this post, we’ve shared a number of different methods that you can use to increase your WordPress site’s max file upload size.
For the simplest option, you should start with the free Increase Maximum Upload File Size plugin. However, remember that this plugin will only work if your WordPress site’s max upload is set below your server’s limit – it can’t increase the server limit by itself.
If the server limit is the problem, you’ll need to try one of the code snippets that we shared. And if none of those work, you can reach out to your host’s support to see if they can help you out.
Or, you can also get around this issue entirely by uploading a file via FTP and then using the Add From Server plugin to import it to your Media Library.
For more tips on how to fix these types of WordPress issues, check out our guide on how to troubleshoot WordPress errors.
Still have any questions about how to increase the maximum file upload size in WordPress? Ask us in the comments!
SeedProd is one of the elders of the WordPress ecosystem. It's also a bit of…
Really Simple Syndication (RSS) feeds are a vital component of the WordPress ecosystem. They act…
It’s that time of year again when people start revving up their shopping lists, hunting…
If you clicked on this post, I’m guessing you want to find the best solution…
Trying to figure out how to start an online course so that you can share…
Considering using Teachable to create an online course? In our hands-on Teachable review, we'll help…
View Comments
Nice tips and I was searching for these solutions.
Thanks for sahring
php_value upload_max_filesize 32M
php_value post_max_size 32M
php_value max_execution_time 300
php_value max_input_time 300
where to add this code ?
before or after
# END WordPress
in .htaccess file