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.

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 am a developer based in Austin, Texas. I run a little theme shop called DevPress and help manage a WooCommerce shop with Universal Yums. Find me on twitter @devinsays.

184 Responses

  1. Hi there,

    I’m using justhost.com and uploaded your php.ini file into the wp-admin and public_html folders through cPanel (because I couldn’t locate one or create one through cPanel).

    I attempted to upload a 15MB file – initially I was getting the ‘max size 8MB’ error. The upload got to 100% then went to the ‘crunching’ phase and stopped with an ‘HTTP error’.

    Any ideas?

  2. UPDATE:

    I just contacted JustHost via their live chat and they told me that it is ‘Company Policy’ to only allow a max file upload limit of 10MB.

    Damn, I guess I’m going to have to always use FTP to handle larger files.

    I’m not sure how this is going to work with adding new media files to WordPress??

  3. Thanks a lot man! This really helped instead of me creating an entire new php. i loaded it up into my wp-admin for a site i was working on and it didn’t give me any exceeded limit probs. kudos :)

  4. Kai

    thanks that solved my issues. i had a php.ini files installed in my root directory but not in my wp-admin. it worked after i changed the file and also uploaded it to the wp-admin folder

  5. Hi everybody,
    I am with dreamhost and they did the same to me as well, even though I have a VPS with unlimited webspace, unlimited bandwidth per month and 1.5GB ram allocated to my account they wont allow me to change the php.ini file to suite. The only way to get access to the php.ini file is to use ssh access which I am not familiar with. I tried uploading your php.ini file into my wp_admin folder with no success, the limit is still set to 8MB even though I have changed the upload and post size limit to 150 MB, any help appreciated. I bet this question is definitely getting old over here with you guys.

  6. I told them if I dont get any help I will switch and they told me bye. Shocking support from what used to be a really good host in the past. Dreamhost has lost my bussiness.Yeah I have been so pissed off with this they forced me to move. Decided to go with Crucial Paradigm, they offered me full access to my php.ini file and best of all they are australian hosting so should go really well.

  7. Hello

    I am working local with wamp for the time being

    I downloaded and used your php.ini file. Now when I load some large file to the meia library i get a different error message, that says that my file could not be saved in the directory, and actually it is not in the usual directory..

    May you help ? Thanks

  8. cecile

    maybe you could tell us more about this script Nick ?

    I found one to to be written in the ht access file, works fine in local, but did not work with a french hoster called 1&1

  9. cecile

    this is the script to be written anywhere in the ht acess file :

    php_value upload_max_filesize 20M
    php_value post_max_size 20M
    php_value max_execution_time 200
    php_value max_input_time 200

    And to devin : no I did not tickle wamp, I’ll be on line shortly, so I need to find a solution that will be okay outside of wamp..

    1. vinceintokyo

      I’m on MediaTemple (essentially Dreamhost) and so far, the htaccess file script above seems to be the only thing that is working…

      Thanks for this…

      1. I’m on Media Temple as well and they do it in a whole different way. If you are on the Grid-Server then follow the following instructions. You need to edit the MASTER “php.ini” file through your admin.

        http://kb.mediatemple.net/questions/137/How+can+I+edit+php.ini+file%3F#overview

        *NOTE: but wait there is more! I tried the methode mentioned above and nothing changed. Then I added the following lines

        memory_limit = 80M
        upload_max_filesize = 80M
        post_max_size = 80M
        file_uploads = On

        Saved the ini file and the upload works beautifully on the Parent and all sub domains.

  10. Ok Guys,
    tfor those on dreamhosts servers here is the hack to be able to access a php.ini file and modify the settings. http://sxi.sabrextreme.com/phpini

    * Download the script from the link in here.
    * Install the script by going to the script URL

    The patch basically installs a php.ini file in the cgi-bin folder of your hosting.
    * To Edit your php.ini file simply download the php.ini file that was created in the cgi-bin folder to your computer.
    *Edit the file through notepad.
    *Look for the Maximum file size upload limit, max Post size and also dont forget to set the resources limit higher (RAM) to desired level.

    * Overwrite the file with your modified version. Reboot your server through your web hosting panel and you are done.

    I have successfully increased my file size and post size limit to 150MB. I have set the ram allocated to wordpress up to 1500 MB as provided for by my VPS. The website runs alot better too now, much quickewr as the ram level was increased from a pissy 8MB to 1.5GB.

    Good Idea to create an unmodified backup file of the php.ini file just ncase you screw things up.

    I hope my words of wisdom have helped guys. They didnt come easilly. And dont bother contacting dreamhost about help in doing this as they rudely and blatently refuse to do so. Their product is excdelent however the support services are in need of a serious restructure if they want to go into the mainstream market.

    Hope this helps guys, here is my URL http://www.showoffyoruwheels.com.au

  11. ArulMaria

    Hi,

    I am using wamp and i installed wordtube. I am new to using wordpress and i havent started hosting yet. i am just building a site in my localserver. when i tried to upload a .mp3 file i got ERROR : Upload failed. Check the file size. So i googled and landed in your page . I downloaded your php.ini file and saved it in my wp-admin folder. but stil i am getting the same error. i am unable to upload and it gives ERROR : Upload failed. Check the file size. Any solutions and suggestions welcome ASAP :)

  12. Rohan Sehgal

    Thanks a lot!!!! It really works for me..Now I am able to upload any size of file on my server using wordpress.

    Thanks
    Rohan

  13. arul maria

    hi rohan

    can you please temme how it worked?? coz i ve been trying, posted a comment here too but still no responses and solutions :(

    Regards,
    Arul

  14. Hello

    I am back just to tell those who have problem that I have been working on 2 different hosts subsequelntly : with the first one, what did the trick was the php.ini file in the wp-admin folder.
    And with the second host, it doesn’t care about the php.ini, but the changes in the ht access file worked.
    So well, try both methods…

  15. CJ

    @ merlot: agreed!!
    @ developer: THANK YOU. worked perfectly.
    @ anyone who knows enough about their hosted files to be dangerous (ie: can crash and uncrash your site with the click of a mouse on a daily basis goofing with it), but needs 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 :-)

  16. Thank you. I’m not a techie by any means and it worked first time (I am on Blue Host so that helped give me confidence). The previous 10MB limit is now 64MB…perfect. Thank you again

  17. Help Please!
    I added the php.ini file to my wp-admin but it does not change.
    I am using wp network setup, know before as MU and my hosting is with hostagtor.
    I am wanting to upload a video file that is over 50mb but for some reason it is not working.
    Is there something different that I need to do n/c of it being WP network?

    Thanks
    Corina

  18. John

    I’ve been trying to figure out how to get around this problemfor a for a while. The fix(copy the php.ini ) worked perfectly. Went from 8M to 64M.
    1&1 hosting.

    Thank you very much!

  19. CloakofZeal

    I’m running WAMP, and editing the php.ini file in the wamp menu partially worked, raising the level to 8M.

    The block is a php.ini file in the Apache folder, where you need to set post_max_size and upload_max_filesize, then restart the server.
    If you only set one of them, WP will pick the lower limit.

  20. Everyones gotten such great results, im sad it didnt work for me.

    I uploaded your php.ini file to wp-admin and see no change in the media upload file size.
    any ideas why this would fail on a regular wp install?

    I also tried the htaccess and got a 500 internal server error on the site, so I probably did that wrong.

    any ideas?

    1. If you changed the php.ini file max file size and max post size all you need to do to get it working in to reboot your server for it to work and beleive me when I tell you it works it works. If you dont reboot your server it wont read from the file. Think abut it, ini extension is an abreiviation of the word initialize which means it is only read when the servewr is rebooted and kept in cache. Siply uploading the php,ini file wont allways work because the server may not be configued to look for a php.ini file during start up so if you read a bit more of my previous threads it desribes downloading a script to your ftp folder, opening the url and following the destructions. Then you will have a php.ini file you can modify that when you alter after a reboot will work for you.

      1. i believe rebooting the server is something id have to ask my host to do, since Im on a shared hosting account. any way around that? Ive tried everything to get this to work, htaccess, editing the wp-config file, editing the functions file and this php.ini override, each a bunch of different ways. Nothing works. Im at the point where Im thinking id have to move my site to a different hosting server to get this to work.

      2. I tried uploading the file to both the root directory and wp-admin. no luck. My host told me that their php default upload is 2Gb, looking in php info, it says 2mb. So youre right about that switch.

        Great tutorial though. I really love this blog. I made a killer theme with your options framework. Great Stuff! It all works wonderfully, you’re a good teacher!

  21. Devin and CJ–thank you thank you! I’m not tech savvy by any means, and your instructions for working with WP and Bluehost worked perfectly after I restarted my browser.

    I have a video that’s over 45 mins and over 1 GB in size; is it ok to increase the max upload size to be 1.5 GB? Wanted to ask before I caused any major errors.

  22. Jane

    I have put the php.ini file in wp-admin on FTP and then I go back to the website and I can’t access the Dashboard!? It’s just white space?? Any ideas??

  23. JT

    I was having this issue as well, I troubleshooted for hours, in addition to updating the php.ini file , you also need to make some changes in GUI, I’ve listed the steps below, which I found from this post : http://wordpress.org/support/topic/changing-file-upload-limits

    Get to the Network Admin page. In WordPress 3.1 this link is found on the top right of the admin screens. It toggles between Site admin and network admin.
    Click on “Settings” in the admin panel on the left hand side of the screen.
    Near the bottom of this page is a section called “Upload Settings”. Find it.
    There is a field for “Max Upload File Size”. The units are KB.
    Convert your intended file size into KB. (100MB = 100 * 1024 * 1024KB = 104857600KB)
    save changes at the bottom and test for sanity.

  24. Ron

    when changing the two parameters in the php.ini file it will be necessary to restart you http server (service httpd restart on redhat, centos, FC) in order for it to pick up these two changes in php.ini. I have read several posts where people state that these changes did not correct the problem. I too ran into this but when I restarted my httpd server I could upload the larger file size. Hope this helps.

  25. […] As I was going over the email folder that is called “Soon”, I realized there was a request from Debra to increase the Maximum upload file size in the WP admin are, specifically on the media library, then I realized that this is in deed possible on the servers we are hosting, not by updating the php.ini (as that is not allowed there), but by adding two lines of code to the .htaccess on the wp-admin folder as explained here: […]

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

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

    1. Igor Grinkin

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

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

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

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

Leave a Reply