There are a few ways to increase WordPress upload limit, this tutorial will show you the easiest way to change the upload limit and it doesn’t need any code in the htaccess or changing of phpini file, all you need is cPanel.
Most webhosts use cPanel those include bluehosts, hostgator, siteground among many others.
If you are running into problems uploading files into WordPress and you get a message that says ‘The uploaded file exceeds the upload_max_filesize directive in php.ini‘.
I’ll show you how to easily change that from within cPanel just by changing some settings. This is a beginners tutorial so anyone who has access to cPanel can increase WordPress upload limit without much trouble. This will even work for your other upload scripts even if you aren’t running WordPress.
I had to recently change a WordPress theme for a client but I couldn’t upload the theme via the theme screen because it returned the file exceeds upload limit error (as above). So I had to transfer the files via ftp and sort it out that way.
Uploading via ftp isn’t a problem but I wanted to make sure I was able to increase WordPress upload limit just incase I need to upload other files to my web server in the future; files such as pdfs or images are always likely to be larger than 2MB.
The default was set to 2MB and the theme zip file was 7MB+, it took a long time to return the error because it tried to upload the file first but failed, usually the upload speed is slower than the download speed with the ISPs so soon after waiting I found out that I needed to increase the file upload limit, my instant thought was to try increase the limit from within the htaccess file using:
php_value upload_max_filesize 40M php_value post_max_size 42M
But that doesn’t always work especially if your server configurations are different, I found that you could also try to change the upload limit by adding these lines in the phpini:
;Maximum allowed size for uploaded files. upload_max_filesize = 40M ;Must be greater than or equal to upload_max_filesize post_max_size = 40M
However not everyone has access to the phpini file, so what do you do when you don’t have access to the phpini file and the htaccess method doesn’t work?
Well if you have a cPanel account then you can easily increase WordPress upload limit by following these simple steps:
- Login into your cPanel account usually something like example.com/cpanel
- type in PHP in the search field that should bring up 3 PHP options, you’ll need to click on ‘Select PHP Version’
- now click on ‘Switch to PHP settings’, you’ll see a list of phpini directives (options) that you can change. It will look grayed out don’t worry you can change those just by clicking into it
- to increase the file upload limit you will need to change two directives:
- set those to whatever you like, so if you wanted to upload up to 64MB files then you would set it to 64MB from the drop down list
- click apply each time you change a value from the drop down list
- finally click on the save button at the bottom of the same page.
Following the above correctly should allow you to upload larger files via your WordPress installations or other PHP scripts easily.
One thing to note is that, if you pause over one of the options whilst changing the post_max_size limit you’ll see some important information. It tells you that this should be set to less than the memory_limit and more than the upload_max_filesize. So if you run in to trouble make sure you check those.
Hope this helps you overcome your uploading woes. Let me know how you get on and if you are able to increase your upload limits via cPanel.