Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Increase the Maximum File Upload Size in WordPress

Last updated on by
Elegant Themes
How to Increase the Maximum File Upload Size in WordPress

Depending on the web hosting company you choose and the package you select, each of you will see maximum file upload limit on your Media Uploader page in WordPress. For some it is as low as 2MB which is clearly not enough for media files like (audio / video). Most pictures are under 2MB, so it is fine for just pictures. In this article, we will show you how to increase the maximum file upload size in WordPress.

Media File Size Limit

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.

1: Theme Functions File

There are cases where we have seen that just by adding the following code in the theme function’s 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

In most cases if you are on a shared host, 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. 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. Open or create the .htaccess file in the 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. Some hosts completely turn down their users. We recommend that you use HostGator. Their support folks are very helpful in these situations.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. Dan Rosenberg says:

    PHP.INI method worked perfectly. Thanks!

  2. QuangPham says:

    Thanks for the instructions on how to fix.

  3. Voicu Ioan Virgil says:

    Thanks, great tutorial !

  4. Maria McCarthy says:

    Adding the php.ini file to my wp-admin folder SPECIFICALLY worked for me as well! Thanks everyone! Only took me almost 4 hours to find a page that had the info which would work for me – lifesavers!

  5. pete says:

    found the php.ini worked in wp-admin network php.ini

  6. Tabassum Javaid says:

    htaccess method works fine for me. thanks

  7. Mike says:

    with some host ( godaddy ) for example, there may be some additional steps.

    And to what php you are running. For godaddy with php5, rename php.ini to php5.ini and remember if you have accuracies running, you will have to temp. end them before the file will even take over, or wait awhile for it.

    System Processes / End all

  8. jaymz says:

    Many thanks for the article. For self-hosted there’s another way as methods 2 and 3 didn’t work for me as the .htaccess change had no effect and neither did adding a php.ini file in /wp-admin. It was simply a case of finding the existing php.ini file for Apache. On Ubuntu I ran;

    sudo find / -name php.ini

    This found my ini file in /etc/php5/apache2/
    All that was needed was to locate the parameters and update the values for;
    upload_max_filesize
    post_max_size
    max_execution_time

    Thanks for getting me there!

  9. D Winzell says:

    Thanks for writing this. The php.ini does need to be in the wp-admin directory to function correctly. Just checked my host (Vaurent) and they allows up to 105M file uploads so I am going to find something that size and see if it makes it’s merry way up to my blog.

  10. Matt says:

    I just want to add, using godaddy you cannot use the htaccess method, it will throw you into a 500 internal service error.

    You must use the php.ini method. Only difference will be you have to have a php.ini and a php5.ini and the lines must be added to both. The files need to be in the root directory of where the wordpress install is, not in the wp-admin folder, outside of it.

    Also if you have multiple wordpress installations This has to be done and placed into each directory that each wordpress installation is located.

  11. GSJha says:

    Very Good Post.

  12. sandeep says:

    php_value upload_max_filesize 64M
    php_value post_max_size 64M
    php_value max_execution_time 1500
    php_value max_input_time 1500

    i use these values in .htaccess and it works !

    thanks

  13. Thyme says:

    So I did all of those and changed the php.ini in the /etc folder (my site is on mediatemple’s grid-service) and nothing was working but then I vaguely remembered there was something I had to change in the network settings if my installation was multisite and there it was. Ugh.

    So yeah, if you’ve got a WordPress network, go to your network settings and change the max file size upload near the bottom of the page.

  14. Alex says:

    This is the only thing that worked for me, I tried all the options, I’m on 1&1

    memory_limit = 32M
    upload_max_filesize = 32M
    post_max_size = 32M
    file_uploads = On

    ** Size can be anything

    The key was the “file_uploads” line

    Place this in the /wp-admin/ folder.

    • Kristina says:

      Worked for me! I’m on Bluehost.

      Thanks for your post :)

    • Brandon says:

      this worked for me after everything else hadn’t. I’m so relieved!

      I’m also on 1&1. Once I added the “file_uploads = On” line to my php.ini file it worked like a charm!!

      thanks!

    • Hafeez Ansari says:

      Thank you Alex, This works for me in /wp-admin/ folder. Problem solved. :)

  15. Noor says:

    Worked by .htaccess method. Salute man.

  16. Bogdan says:

    Great advice. My upload limit was 8MB and I only tried the htaccess trick and it worked, it increased to 64MB. I tested it and it is owrking beautiful! Thank you so much for your great advice!

  17. VoidnessMD says:

    Important thing to note: Using the php.ini method requires that the file be located in the wp-admin folder, not the root of your WP installation.

  18. David Connolly says:

    Superb… clear and the final solution worked.
    a big thank you

  19. Bongo says:

    This website is the coolest for learning WP! Keep up the good work guys…more please…more! lol

  20. Ido Schacham says:

    Finally, a post that clearly explains how to change the memory limit in WP. Thanks!

  21. mostafa says:

    hi.
    i successfully did it with the third method. my upload size was 8 M, but now its 64 M. for me its more than enough.

    Thanks a million.
    by the way i’m from Iran.

  22. Rowan Evenstar says:

    The creating a php.ini file and popping it on the route sorted it straight away!
    Cheers, much appreciated!

  23. assassinateur says:

    thnx, but i am in a shared hosting so nothing work, i did put the php.ini in wp-admin and in the blog folder and in the homefolder and dodnt work also .htaccess didnt work changed the theme and didnt work

  24. Arvind Kukreti says:

    Adding code in .htaccess file might throw you 500 Internal Error… the best way is create a php.ini file and upload it in wp-admin folder

    • Stephen Afije says:

      Waooo that was brilliant one there all i did was to create php.ini and uploaded to the wp-admin folder it worked like no other thing thanks

  25. leo says:

    htaccess method works fine for me. thanks

  26. Andrew Lilly says:

    Hi,

    I have done all of the above and still wont let me import an 11mb xml file. i need it as its got 1500 products on i need to import.

    I have spoken to my virtual server provider 1and1 and they said all i need to do is add the code to the .htaccess file but it doesnt seem to work

    Please someone help

  27. Dominique says:

    None of this worked for me. I tried them all. I am using WPEngine to host.
    Any suggestions?

  28. Thad says:

    The htaccess method worked for me. Thanks for the post. Good info, well presented.

  29. Richard says:

    php.ini option worked for me but on the php.ini file in /wp-admin directory

  30. marin says:

    Thanks htaccess worked for me appreciate it.

  31. Makarand Mane says:

    I have hosting on mediatemple. First two methods are not worked me. Only htaccess methos is worked for me.

    Thanks.

  32. Gavin says:

    I found that php.ini was hidden in the cgi-bin folder which some shared servers have in their root directories. I amended this as above (AND added a php5.ini jut in case) but until I’d amended this, nothing else worked. Thanks for the VERY useful thread!

    • Cath says:

      Thanks Gavin, none of the other methods worked for me then I saw your comment, there were php.ini and php4.ini files were in the cgi-bin folder. I found the relevant code in both files – post_max_size = , and upload_max_filesize = , amended these and now all works fine.

  33. Jarod Billingslea says:

    Thank you very much for this article!

  34. Void lon iXaarii says:

    thank you so much! had tried so many solution and your .htaccess finally worked

  35. Anthony says:

    The only thing that worked for me was to create/edit a php.ini file and add the following:
     
    memory_limit = 100M upload_max_filesize = 100M post_max_size = 100M file_uploads = On
     
    and uploading it to the wp-admin folder.
     

    • Alan says:

      Option 2 worked perfectly fine, though I had to place the php.ini file into the wp-admin folder instead of the root directory.

      phpinfo was detecting the php.ini file in the root, but not WordPress.

      I currently have WP 3.2 installed…

    • arun says:

      thanks anthony, your method saved me a lot.

    • Quest The Wordsmith says:

      This is exactly what worked for me as well.

  36. RamiAlloush says:

    Thx :)

  37. Snowboard says:

    thx for this post , but what is the default limit ?

  38. kat1111 says:

    I am evidently newer than most here, I don’t understand which is “root” directory, is it Editor under the Appearance tab? Also, I don’t undertand how to get to hcaccess. Any help is appreciated.

  39. jameserie says:

    htaccess method works for me. – cheers!

  40. MyDreamDinZ says:

    What is the highest limit for upload

    can i set it to 1024M ?

  41. alexlee.cs says:

    The .htaccess method works for me. Thanks.

  42. rajkanuri says:

    Thanks for the code.. it is really helpful for me..

  43. pranjalgupta2009 says:

    Yes ! putting php.ini also in wp-admin works for me. thanks

  44. Snipsley says:

    Thanks, but neither of this worked for me.

    But I found the solution!
    I had to place that php.ini to /public_html AND /public_html/wp-admin and it works!

  45. Kaushik Biswas says:

    At the end of a post, I want to display recent posts from that specific category under that post – how can I do this?

  46. Clemens Plainer says:

    Thanks for that tip. But obviously I’m on a shared server ;-(
    so that didn’t work for me.

  47. Ben Peacock says:

    Sorry please find this instead Login to the root machine type the following command nano /usr/lib/php.ini

    find ; Maximum size of POST data that PHP will accept.
    post_max_size = 2M change this to 64

    Save and exit and then you should be able to upload what you need hope this helps :)

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.