Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Increase the Maximum File Upload Size in WordPress

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.

Increasing maximum file upload size in WordPress

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

Subscribe to WPBeginner

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.

Checking maximum file upload size limit in WordPress

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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

400 CommentsLeave a Reply

    • It would depend on your host and what else is set up on your server for what will work. If nothing else works you can always reach out to your host for assistance.

      Admin

  1. You comments and thanks secion is almost 10 times longer..than the content of this page is guarantee of your amazing tips

    • 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.

      Admin

  2. 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.

      Admin

    • 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.

      Admin

  3. If you have access to the FTP, can I just upload the file in the wp-content/uploads/[year]/[month] folder?

    • It would depend on the method you are using but it could help with restoring a backup that large.

      Admin

    • If none of the recommendations worked we would recommend reaching out to your hosting provider for assistance.

      Admin

  4. 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.

      Admin

  5. 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

      Admin

  6. 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

    • 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.

      Admin

  7. 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

      Admin

  8. 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

      Admin

  9. 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?

  10. 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.

  11. 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 :)

      Admin

  12. 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 :)

      Admin

  13. 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.

      Admin

  14. 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.

      Admin

  15. Thanks buddy i have solved my problem by adopting method 2 by editing my php.ini file
    Thanks alot you are working great

  16. 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 :)

      Admin

  17. 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

  18. 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.

      Admin

  19. None worked for me. But this one fixed it – add to your .htaccess this line:

    LimitRequestBody 104857600

  20. 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.

  21. 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?

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.