Do you want to increase the maximum file upload size in WordPress. Some times low file upload size limit can stop you from uploading files via media uploader, or install plugins and themes. In this article, we will show you how to easily increase the maximum file upload size in WordPress to fix those issues.
Note: This is an intermediate level tutorial. It may not work with some shared hosts in which case you would have to ask your hosting service provider for support. We use HostGator, and they are more than helpful when it comes to issues like this.
Video Tutorial
If you don’t like the video or need more instructions, then continue reading.
How to Check Your Maximum File Upload Size Limit in WordPress?
WordPress will automatically show the maximum file upload size limit when you are uploading images or media. To check it you can simply go to Media » Add New page and you will see the maximum file uplaod size limit for your WordPress site.
1: Theme Functions File
There are cases where we have seen that just by adding the following code in theme’s functions.php file, you can increase the upload size:
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );
2. Create or Edit an existing PHP.INI file
For this method you will need to access your WordPress site’s root folder by using FTP or File Manager app in your hosting account’s cPanel dashboard.
In most cases if you are on a shared host, then you will not see a php.ini file in your directory. If you do not see one, then create a file called php.ini and upload it in the root folder. In that file add the following code:
upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300
This method is reported to work for many users. Remember if 64 doesn’t work, then try 10MB (sometimes that work).
3. htaccess Method
Some people have tried using the .htaccess method where by modifying the .htaccess file in the root directory, you can increase the maximum upload size in WordPress. Edit the .htaccess file in your WordPress site’s root folder and add the following code:
php_value upload_max_filesize 64M php_value post_max_size 64M php_value max_execution_time 300 php_value max_input_time 300
Again, it is important that we emphasize that if you are on a shared hosting package, then these techniques may not work. In that case, you would have to contact your web hosting provider to increase the limit for you.
We hope this article helped you increase the maximum file upload size in WordPress. If you are still having issues, then follow the steps in our WordPress troubleshooting guide to fix it.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
htaccess Method has worked for me.
Glad our recommendation worked for you
its not working.
If the recommendations are not working for you, we would recommend reaching out to your hosting provider and they should be able to assist if this is something they’ve set on their end.
Thank you so much. I tried all the methods and the last method was helpful for me.
I would like to know should I undo the second last step that was php.ini?
It is not required to remove that file but you can remove it if it is not working for your server.
None work.
If none of our recommendations work, we would recommend reaching out to your hosting provider to see if it is a restriction that they have set on their servers.
If you have access to the FTP, can I just upload the file in the wp-content/uploads/[year]/[month] folder?
If you do that you would need a plugin to find the images, we have a guide on how to do that below:
https://www.wpbeginner.com/plugins/how-to-bulk-upload-wordpress-media-files-using-ftp/
Thanks a lot
.htaccess method worked for me.
You saved my lot of time.
Thanks again.
Glad our guide was able to help you
Does this method works for restoring backup that is up to 3.5gb manually?
It would depend on the method you are using but it could help with restoring a backup that large.
method 3 is perfectly worked for me.keep inspiring us.great work man.thnks
Glad our recommendation was helpful
.htaccess methode worked with me
Glad our recommendation was helpful
Does this work on free hosting?
You would want to check with your hosting provider if you are concerned
It works for me
Glad our recommendation helped you
nothing is working for lms
If none of the recommendations worked we would recommend reaching out to your hosting provider for assistance.
I tried this but the size did not change… status is same please help what should I do know I am using localhost
You would want to try restarting your localhost service just in case, otherwise, you would want to ensure you added/editied the php.ini correctly for the most common reason.
I think
@ini_set( ‘upload_max_size’ , ’64M’ );
should be
@ini_set( ‘upload_max_filesize’ , ’64M’ );
upload_max_size currently increases that value as well as a few other things which is why we don’t use upload_max_filesize
Thank you. The 3rd method worked for me. Very useful post and video.
You’re welcome, glad we were able to help
Wow !its work. Thanks
Glad our guide could help you
IT WORKS!!! THANKS
I made a file ini.php then uploaded it, then renamed it from ini.php.txt to ini.php and it worked.
thanks
You’re welcome, glad our guide was able to help
None of these works
If our recommendations do not work you would want to reach out to your hosting provider to ensure they do not have it as part of their settings.
Method 2 worked for me thanks a lot ive been struggling with this for two days …
You’re welcome, glad our recommended solution was able to help you
you are great.I fix my problem by reading you post.Tnx
Glad our article could be helpful
Method 3 worked
Glad our recommendation worked for you
Method 1 worked wonders for me. Thanks a bunch!
You’re welcome, glad our recommendation worked for you
Thanks Method 3 really worked for me.
Glad our recommendation was helpful
How can i increase the upload limit while i have the wordpress hosting also functions.php isn’t updating
If the file will not update, you would want to reach out to your hosting provider and they should be able to assist
I want to increase the limit to 250mb but i dont know if this exposes my site to security treats, though am only using gravity form and I have also set to disable php execution on my upload folder. And have allowed only jpg, and mp3 files.
Please do you think this may affect my site load times as huge upload is coming from several users?
If multiple users attempt uploads at the same time it can have an effect on your site’s load time but it shouldn’t open you to security threats
Thanks a lot!!! Method 3 worked for me
Glad our recommendation worked for you
Nice article, but I tried adding your 3 lines of code to the functions.php file, but got an “unknown @ rule” error. What’s that all about?
It would depend on the entire error but it could have been a hiccup with how the code was inserted, you may want to take a look at our guide here: https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/
Thanks a lot!!! Method 3 worked for me
Glad our recommendation could help
Thanks, this helped me troubleshoot an upload limit. I’m on a WordPress multisite network install, so it ended up being a setting in the Network Admin Settings.
I was confused at first, because my php settings were allowing larger uploads, but it was restricted in the Network Settings.
Thanks for sharing what solved the problem for you
Would have been great if you have included the .user.ini method.
.user.ini uploaded in the root folder with the same value/text in your edited php.ini
Most of the time, only this method works for shared hosting.
ErnestPH
The php.ini file should work the same as the user.ini file unless your specific host ignores the php.ini but thank you for sharing your recommendation
This is the only solution that works on my shared hosting server. Thanks Ernesto!
Not working for me.
I have followed this guide and double checked the php.ini file to make sure that the changed are in fact saved. changed htaccess file to increase limits. and also tried modifying the phpMyAdmin httpd-app.conf and php-settings.conf file. All of these files reflect max upload higher than 40m and my WP site does not reflect Any of these changes. Really frustrated here.
Please help me, thanks !
If you haven’t already, you would want to reach out to your hosting provider to ensure there is not a setting on their end that is overriding what you are setting
i have tried all 3 method none of them worked. i am trying to upload newspaper theme in my in my wordpress site. but every time it show that php.ini file upload max file size.
plz help me
You would want to reach out to your hosting provider to ensure they don’t have a setting that is overriding the changes you made.
Watchout for hidden php.ini files. In my setup I found 2 of them. The one which I found actually resolved the issue was found under
./etc/php/7.0/apache2/php.ini
modifying this file fixed my issue.
Thanks for sharing your solution, with where that file is located we would recommend most users reach out to their hosting provider before looking in locations like that.
Thanks buddy i have solved my problem by adopting method 2 by editing my php.ini file
Thanks alot you are working great
Glad our article could help
None of the above worked for me. A matter of fact, editing the htaccess file broke my site even after deleting the above code. Overwriting with a new file fixed the problem though.
I have a dedicated server on Bluehost. What worked for me was going in the WHM root, not cpanel nor FTP access. Search for MultiPHP INI Editor. Give it at least 5 minutes to load if you only see the title and icon. You can set you upload time, post size, etc. there. Works instantly, even if your site is using Cloudflare, without placing it in development mode or clearing the cache. I hope this helps someone.
Thank you for sharing what worked for you, should other users be on a dedicated server, if they reach out and let BlueHost know the need to increase the upload size then BlueHost can normally edit that for them
Great Stuff! .htaccess worked for me!
Thank you, glad our guide could help
htaccess metod worked for me, thanks!
Glad our article could help
Work for me
3. htaccess Method
you need to click (show hidden files to view and edit this file).
Glad our article could help
when i tried this
Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.
this happened to me
whats the solution of this
You would need to use FTP rather than WordPress itself to add the code: https://www.wpbeginner.com/beginners-guide/how-to-use-ftp-to-upload-files-to-wordpress-for-beginners/
I had been trying php.ini method but it never works please how will I set it..
Or you should please tell me the were to paste at function.php
You would normally use a text editor to set the content in the php.ini file. For your functions.php it should go at the end normally so it can be removed later as needed. You may also want to check with your hosting provider if you are having trouble with these methods for if they can assist in increasing the file size for you.
None worked for me. But this one fixed it – add to your .htaccess this line:
LimitRequestBody 104857600
Thanks for sharing your solution for this issue
I am using Nginx and i had already setup properly the values for php in the php.ini but what fixed it was puting the same value in the server block with the variable client_max_body_size xxxM;
I am writing this hoping it will help someone.
Thank you for sharing this with us
That worked for me thanx
Glad our tutorial could help
None of the options worked for me. Nothing happened when I tried the first two, and the last one prompted an error 500. Any way you can help?
Very helpful, thank you!
The third option is worked for me.
Hey Rana,
Glad it worked out for you. Don’t forget to follow us on Facebook for more WordPress tips and tutorials.
The above explanation is fine for hosted sites, bit what about us guys that locahost? I still can figure out the “upload_max_filesize” error when downloading Updfaftplus from WP Plugins or from a download zip file. I am a beginner and need hand-holding through this process. Help is appreciated.
hta access worked.
you guys must put the code before #END WordPress
if you put after #end wordpress then site goes to 500 internal server error in my experience with godaddy hosting
Thanks.
On most of the shared cPanel sites I’ve setup:
-changing .htaccess brings the whole site down (500 internal error)
-adding php.ini or php5.ini files does nothing
-there is no option to choose ‘Site Software’ in cPanel…
Thanks so much. The .htaccess file worked for me