Increasing the upload_max_filesize in WordPress

The default upload file size for WordPress is 2 MB, which is a problem if you want to upload a large media files. If you get this error, “The uploaded file exceeds the upload_max_filesize directive in php.ini”, follow these steps:

  1. Locate the php.ini file inside the wp-admin directory (if you can’t find this file see notes below)
  2. Find this line in the php.ini file “upload_max_filesize = 2M” and replace it with a higher value (e.g. “upload_max_filesize = 64M”)
  3. You may also want to increase your max post size. Look for this line in your php.ini file “post_max_size” and increase it as well.
  4. Save the changes to the file inside your wp-admin directory.
  5. Try the upload again
  6. If you still have issues, look for this file in your root directory and make the same changes.

If you don’t have a php.ini file in your directory, you can usually generate one from the control panels of your host. BlueHost has the steps listed to generate a php.ini file.

If you don’t have a php.ini file in your directory and aren’t sure where to get one (or want to see where I made the changes in the code), you can download my php.ini file. I have already increased the upload_max_filesize and the post_max_size to 64M. Once this file is copied into your wp-admin folder, the problem should be solved.

Use a Plugin

Apparently the Memory Bump can do this all for you. I haven’t tried it yet, so feedback would be appreciated.

A Comment From a User

Someone left additional instructions below in the comments. I thought they were hilarious (and accurate) so I moved them up here:

@ Anyone who knows enough about their hosted files to be dangerous (ie: you crash and uncrash your site with the click of a mouse on a daily basis goofing with it), but need baby steps to do this, here goes…

First, copy the text from the developer’s PHP file listed above. (yeah, it’s long…copy all of it….no, don’t change anything. Heck, don’t even read his notes if you get intimidated easily. Really, it’s cool….just copy it as is…)

  1. Get into your files via however you do it on your host (FTP, CPanel, Legacy File Manager, whatever).
  2. Navigate to wp-admin folder. Scroll down to see if you have a php.ini file in there. I didn’t, and if you didn’t add one at some point, yours wont either.
  3. I have CPanel access, so in CPanel’s file manager, click on ‘new file’. Name it php.ini. Save it. Now, find it and check box the file name. click ‘edit’. scroll down through the ‘blah blah’ about encoding. leave the default encoding selection. click ‘edit’. a blank screen will open. right click in the box and paste the developer’s code. Click ‘save’. (if you use something else other than CPanel, adjust as necessary….for FTP, create this all in notepad on your ‘puter, name it php.ini and upload to the wp-admin folder via your fave FTP program….)
  4. Go to your wp admin panel. navigate to ‘media’. click ‘add’. voila, your new ‘limit’ will read ’64MB’. Upload something big and hold your breath. Voila….if your host doesn’t have some imposed limit, your file should be there ready to edit!
  5. IF you messed up somehow and your site breaks, don’t freak out. Just go remove the php.ini file (either by deleting it or by renaming it so it doesn’t get read). Chances are you didn’t ‘select all’ and paste it right. Start over by deleting the text from the php.ini file you just created. re-copy the developer’s text and paste it again. Give it another whirl…

PS: I use GreenGeeks hosting.
PSS: If you have no clue how to access your files on your server you’ll need to befriend a minor geek to complete this fix as you can’t just click a button in your WP admin panel and get it done. You must go play with the files :-)

About Devin

I'm a WordPress developer based in Austin, Texas. Follow my projects on GitHub, or more general WordPress ramblings as @devinsays on twitter.

98 thoughts on “Increasing the upload_max_filesize in WordPress

  1. TheGuardner wrote:

    the Memory Bump plugin has nothing to do with this topic it is only a help for installing wp 3.0 if you have errors.

  2. Pingback: Armando's Work and Stuff · Maximum Upload File Size

  3. Matt wrote:

    For reference, this no longer works on a more up-to-date install.

    • Devin wrote:

      Can anyone else verify this? Matt, did you find a different solution?

      • RastaRican wrote:

        Yes, all the newer installs have it at 64mb.

      • Melvin wrote:

        Verified that this no longer works on newer WordPress installations. Tested it on 3.2.1 without success. :(

      • Jessica wrote:

        This worked for me… thanks!

      • morcom wrote:

        This has just fixed problems for me also.
        Had migrated 4 sites to Hostzilla and trying to update one of them realised the 2M upload problem.
        As a matter of interest I did setup another subdomain using latest WP 3.3.1 which gave same 2M problem.
        Just copied the php.ini files on each domain inti wp-admin – FIXED.
        A big thanks for this fix which took 2 days to get to but was worth the find

  4. Ya, its also not working for me on latest stable version of wp.
    Could you get a new way?

  5. In a wordpress multi site installation you ‘ll have to change manually some values in site_meta table :
    They are:
    1. blog_upload_space – The amount of space a single blog has to upload files to
    2. fileupload_maxk – The largest file that may be uploaded (I believe this is in bytes)
    3. upload_filetypes – This restricts the MIME type that can be uploaded I believe through the Flash uploader

    http://seanklein.org/2009/06/wordpress-php-upload-information/

    • Igor Grinkin wrote:

      You’re absolutely right. php.ini alone won’t increase it. You have to change the “fileupload_maxk” value.
      mysql> select * from wp_sitemeta where meta_key = ‘fileupload_maxk’;
      +———+———+—————–+————+
      | meta_id | site_id | meta_key | meta_value |
      +———+———+—————–+————+
      | 7 | 1 | fileupload_maxk | 1500 |
      +———+———+—————–+————+
      mysql> update wp_sitemeta set meta_value = ’15000′ where meta_key = ‘fileupload_maxk’;

  6. Deianski wrote:

    Thanks that worked for me. I had uploaded your php.ini file and now I can upload 1000 MB files :)
    (bow)

  7. Mark wrote:

    I found nothing in this article to be true. There’s no PHP.INI file, using yours still does not work.

    Uploading a simple *.wmv to be displayed on a simple WP theme has turned a 10 minute job into a two and a half hour job. “.htaccess” file manipulation is also a waste of my time.

    I’ll try the Memory Bump thing, but I have my doubts.

    Moving right along…

    • Devin wrote:

      May not work with all hosts. Good luck.

      • If you are on wordpress multisite It won’t have effect till you made the changes I described earlier on the database. But devin is true it could just depend of your host.
        Good luck

  8. icyiglu.com wrote:

    thanx man….. it worked for me….

  9. Ian wrote:

    Hey thanks for that, it kinda works. I copied your code into my new file called php.ini but now I have the problem that anytime I save a post or page I get the white screen.
    if I delete the url down to http://www.mysite.co.uk/wp-admin/ then I can get back in but it happens every time. Do you have any ideas on this one?

  10. Loren wrote:

    I tried the plugin first with no luck, your php.ini file however worked a charm. Thanks a bunch for helping me solve this headache!

  11. I found if we use WP Filebase plugin, we can upload upto 31 mb file with it and without any further settings.

  12. Had this problem a few weeks ago and this is exactly what I did on my host, it is important that you put the php.ini file inside your wp-admin folder though – this worked fine for me.

  13. David wrote:

    Thanks this worked fine!

  14. joan thomas wrote:

    Adding the sample php.ini file worked for me…my site is hosted on Lunar Pages. Thanks for sharing it!

  15. Dennis wrote:

    Nothing happening for me…furthermore I see no signs of connectivity between Bluehost (ie via cPanel), WordPress, or Filezilla. I add things via FTP and they don’t show up anywhere else…I add files via cPanel and they don’t show up in WordPress, etc…. #hatingcomputerssince94

  16. Jacqueline wrote:

    I am using Microsoft webmatrix, and added the phi.ini files and the WPfilebase plugin, but nothing worked…can anyone help me?

    • Devin wrote:

      These instructions would just work on an Apache server. I’m not sure how you would bump filesize on a Windows machine.

  17. eric wrote:

    worked perfect for me! just downloaded your php file (however I renamed it “php.ini” because it’s called “php.ini.ini” uploaded via cyberduck, and it worked!

    big thanks.

  18. brian wrote:

    I use ipage hosting and just put two lines in a php.ini file

    upload_max_filesize = 32M
    post_max_size = 32M

    and it works fine!

  19. Eugene Byun wrote:

    Attempting to install a new theme on 3.3.2. The Memory Bump plugin was a bust. php.ini doesn’t even exist in this version. Am I missing something here?

    • Devin wrote:

      Yes, step 1: Locate the php.ini file inside the wp-admin directory (if you can’t find this file see notes below)

      You’ll need to create or download the php.ini file if it doesn’t exist.

  20. rahul wrote:

    i am using 1freehosting.com wordpress
    after uploading php.ini in wp-admin folder uploadd file size
    change to 64 mb it still 8 mb

  21. Miguel wrote:

    Using WordPress 3.3.2.
    Worked like a charm creating a new php.ini in wp-admin, via the cpanel file manager, editing it and filling it up with the default php code, like suggested. Thanks!

  22. Susan Kerr wrote:

    WordPress 3.3.1 Apache on WAMP development server
    Followed instructions but kept having limit of 2M. Finally located another php.ini file here: \wamp\bin\apache\Apache2.2.21\bin.
    It had the 2M limit that must have been overriding all other settings.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>