Increasing the upload_max_filesize in WordPress

Posted

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.

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…

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.

126 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. Manojr Tiwari wrote:

    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’;

      • elvizy wrote:

        I am using a wordpress multi site. The instruction for .htaccess did not work, that for php.ini equally but soon as i changed the value from 1500 to 15000 in wp_sitemeta set meta_value of mysql it worked. This can be located in phpmyadmin on your cpanel. Thanks a lot

  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. Manojr Tiwari wrote:

    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.

    • DRiX wrote:

      Elliott’s answer did me fine too. I’m also on Lunar Pages.
      I just connected to my site via FTP, then put the sample php.ini file with the memory already set worked great. BTW as far as I could tell, there was NO php.ini file in there in the first place.
      Thanx all for sharin’ yer wisdom…

  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.

    • Luca wrote:

      Jacqueline & others having issues uploading themes or other files over 2MB to Azure – this thread provided the simplest fix I have yet found on this subject: http://social.msdn.microsoft.com/Forums/en-US/windowsazurewebsitespreview/thread/06e57c7d-187f-4468-8ab3-2fe7e28f1aa4

      The fix is:
      [1] creating a file in a text editor, calling it .user.ini
      [2] pasting this into it: upload_max_filesize = 8M
      [3] saving it and then uploading it to the root of the site [wwwroot].

      I chose the 8M over other possibilities because there are reports that 8MB is the maximum allowed on Azure Web Sites at the moment.

      Hope this helps,

      Luca

  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.

  23. Michelle wrote:

    Just found your page and followed instructions. You saved my tail! You rock!!

  24. Josh wrote:

    This worked perfectly for me. Thank you so much! WP 3.4.1

  25. Colin wrote:

    “First, copy the text from the developer’s PHP file listed above.”

    –How to I get the php.ini file to copy in the first place? Where is it located? I’ve been browsing through my cpanel’s file manager to no avail.
    Thanks.

  26. Joey Z wrote:

    Ftp’d the php.ini file and installed Nova theme perfectly in the required directory: wp-admin folder.

    To get php.ini file, you need to right-click on the link, then select “Save link as…”

    Thanks, to the OP!!

  27. Tim G. wrote:

    .htaccess worked for me, php.ini did not.

    php_value upload_max_filesize  120M
    php_value post_max_size 120M
    php_value max_execution_time 200
    php_value max_input_time 200
    
  28. Matthew wrote:

    For GoDaddy, you will need to create a file in the root directory called “php5.ini”. Copy the code, refresh your WP Admin screen and voila, you can now upload up to 64MB! Also, note that GoDaddy allows you to increase your upload size to max 192MB. This worked like a charm. Thanks for this great info!

  29. Martha wrote:

    Thanks, Devin! I seriously appreciate you working this out. I’ve been having this issue with multiple client sites. Now, I can breath easier now. I’m totally gonna spread the word.

  30. Amy wrote:

    Thanks for this! I knew how to increase the PHP memory limit in WordPress but your post helped me migrate a large blog full of content using the WordPress importer.

  31. Max Keister wrote:

    Tim G’s response about editing the .htaccess file worked perfectly, downloading and uploading the php.ini didn’t.

  32. Femi wrote:

    I’m on GoDaddy. Had to rename file to php5.ini and load into /wp-content/themes/xxx-child directory.

    thanks!

  33. Ian Douglas wrote:

    Tried the php.ini option and no change. The upload limit didn’t change in the Add Media option, and uploads failed. I think there is faulty syntax in your php.ini file. At least in Coda, half the file comes out in green, as if it was commented out. I don’t know enough to know where the fault is. For me, adding to the .htaccess file throws a 500 Internal Server Error

  34. Michael wrote:

    For anyone running WordPress from there own Wamp server in January 2013, here’s what worked for me. I’m a newbie though, so I have no idea otherwise…

    First of all, ignore all the above posts about uploading a php.ini file to WordPress :)

    I changed two copies of php.ini on my computer.

    There is a copy in each of these directories.

    C:\wamp\bin\apache\apache2.2.22\bin

    C:\wamp\bin\php\php5.4.3

    Restart WAMP and hopefully you’ll be good to go.

    • Xam wrote:

      For anyone running WordPress from there own Wamp server in January 2013, here’s what worked for me. I’m a newbie though, so I have no idea otherwise…

      First of all, ignore all the above posts about uploading a php.ini file to WordPress :)

      I changed two copies of php.ini on my computer.

      There is a copy in each of these directories.

      C:\wamp\bin\apache\apache2.2.22\bin

      C:\wamp\bin\php\php5.4.3

      Restart WAMP and hopefully you’ll be good to go.

      —- how did you changed the php.ini on both directories? you just simply copy+paste it or you just change some codes?

      • Michael wrote:

        In my case I just changed the values manually in each (though I guess they should be the same file to start with on a fresh install).

        (i.e. both values, in steps 2 and 3 -
        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.)

      • Michael wrote:

        By the way, there are probably several places to find this info, but I used a PHP in-built function to give all the settings for my computer server setup along with the active php.ini file.

        You can easily put this one line in a PHP file e.g. name it my_phpinfo.php:

        Place this file somewhere in your www/sites directory and if in the root, for example, for a browser in Windows type localhost/my_phpinfo.php

        In my case with WAMP the “loaded configuration file” was:
        C:\wamp\bin\apache\apache2.2.22\bin\php.ini

        I just googled my solution and I found wordpress.org/support/topic/change-maximum-upload-size-and-find-phpini

        Apparently you should never keep this file accessible on a production server as you’ll be giving hackers way too much information.

  35. sophie wrote:

    The published advice from a user comment worked brilliantly for me; I created the file in cPanel as advised, then dragged the created file into my FTP program & it solved the problem in an instant! Fantastic!

  36. modmanmatt wrote:

    your php.ini file worked for me :) thanks

  37. Joseph Sacco wrote:

    I’m running 3.5.1 with FatCow and your php.ini file worked like a charm! THANK YOU SO MUCH! I’ve been racking my brain for days trying to figure this out!

  38. Pieman wrote:

    Hey, great feature this, I just uploaded the latest WordPress 3.5.1. and had this issue, I downloaded your ini file and uploaded it and it worked fine. Thanks very much.

  39. Tom Gillione wrote:

    I’m hosting with HostZil.la Premiun Cloud and it works when I uploaded Devin’s php.ini. Thanks!

  40. Leena wrote:

    THANK YOU!!! This error could’ve caused me a lot of problems but your article helped. I used the php.ini file and it worked a treat :D

  41. Jesse Phillips wrote:

    Can you update your post to say this only works for Apache users? Lots of time spent trying this on Microsoft Web Matrix before I read the comment that it is only for Apache. Still, thanks for helping others.

  42. Jesse Phillips wrote:

    For Windows Users see this link:
    http://wordpress.org/support/topic/where-is-this-annoying-phpini-file

    Be file to edit just the upload_max_filesize in the php file and not to overwrite the entire file with the php.ini file provided elsewhere as this might break your installation of wordpress.

    The php.ini file should be in your program files directory:
    C:\Program Files\IIS Express\PHP\v5.x\php.ini

    The “x” simply represents whatever version of PHP was installed.

    Windows by default hides system files. A *.ini file might be considered system and not show up in Windows Explorer… So go into the php folder using a command prompt window and enter:
    notepad.exe .\php.ini

    Using a phpinfo file should tell you the path to the .ini file.

    If you are not familiar with php it may then be advised to use great care in editing your php.ini file.

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>