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

    Thank you for your help, it worked perfectly!

    Though in my version of wordpress, the php.ini file is situated in wamp\bin\apache\apache2.2.22\bin ,that’s why some people can’t find it in their wp-amin folder (and if they try to create one, it’s overrided by the previous one existing) !

    Once again thank you for sharing!

  2. Paul

    Unfortunately I tried the new php.ini in wp-admin but am getting this error:

    “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”

    An ideas?

      1. Please try to restart your php. If you don’t have access to do that (on shared host), you could use htaccess instead of php.ini to increase upload_max_filesize, add following to .htacess
        php_value upload_max_filesize 64M
        php_value post_max_size 96

        If that still don’t work, please consult your web host. Web host may have configuration that prevent you to increase file size

  3. Hi there,
    Still at the early stages of building my website but just wanted to tell you what works for me.
    1. php.ini was nowhere to be seen in cPanel/File Manager
    2. I created a new file that I name php.ini (it’s a text file btw)
    3. I pasted the following into it :
    upload_max_filesize = 32M
    post_max_size = 32M

    4. I moved it to the root of the directory (in your home directory)
    5. Refresh and voila your upload limit should now be 32M (check in WP Admin Panel/Media/Add and you should read 32MB)

    Thanks everyone for your precious help!

    Nico.

    1. I literally spent hours on the interweb scouring for insight into this issue. It took a while for me to figure out that you meant to create a “FILE” not a “FOLDER”, but I am fairly new to this whole thing. Once I got that down everything went smoothly. Thanks, your advice was the best I could find on the net.

  4. Thank you for posting your own php.ini with the max upload already increased. I am glad to see such a well-commented file, and I wonder why it was not included in the wp-admin directory in the first place.

  5. newbie1988

    Hello everybody,

    My problem is that my php.ini file only contains the words: safe_mode = off;

    Can anybody help me? Should I create a new php.ini file?

    Would appreciate any help!

  6. Simon

    I have copied the PHP.ini file above to my wp-admin folder and wordpress root folder and done an IIS reset, still the upload remains 2mb

  7. za

    Hey, many thanks. It’s been 2 days since I got this problem. It’s solved after I download and upload your php.ini file to my wp-admin folder.

  8. Gemma

    I can’t get it to work I loaded your code into the wp-admin file using cyber duck and refreshed the server and the browser and still nothing. Am I doing something wrong?

  9. Elton

    Yeah, not getting this to work either. I copied and pasted everything from the link. I refreshed the cPanel, and nothing. Anything else to try?

  10. Mark Dionne

    After changing /etc/php.ini I needed to restart Apache before the change was honored. On my system:
    sudo service httpd restart

  11. Luisa

    It didn’t worked for me :( I did everything right and I can see de php.in file in my FTP folder and everything but the size limit in my wp still the same and I can’t upload my theme.

    I’ll try tomorrow with my host provider…

  12. irwan

    make some php.ini at wp-admin on file manager cpanel

    write content
    upload_max_filesize = 32M
    post_max_size = 32M

    done. no one else.
    yiipiiiie

  13. sam

    1:- open “C:\wamp\bin\apache\apache2.4.9\bin” folder and find “php” which is a configuration file and open it in ur notepad and again find “upload_max_filesize” and “post_max_size” and change both and save.
    2:- open “C:\wamp\bin\php\php5.5.12” folder and find “php” and “phpforapache” which are configuration file and open both in ur notepad and again find “upload_max_filesize” and “post_max_size” and change both and save.
    3:- finally restart all services of wamp and enjoy…lov u all

  14. I can’t get it to work. I have two WordPress sites installed. One gives me 2MB upload and the other just 1MB. I’ve tried everything that’s been suggested, but to no avail. :-(

    1. Hey, just be sure that your file is php.ini (.ini extension)

      I was failing because I used Dreamweaver to create the file and it was saved as php.ini.php. Note the php extension at the end of the file name.
      Inside this file, just copy and paste the text below:

      upload_max_filesize = 80M
      post_max_size = 80M

      Once you have it created, upload it to the folder wp-admin.
      That would be enough.

      1. Wannabe Nerd

        I am and having no luck – even with FTP!
        The file won’t upload on Filezilla – the transfer keeps failing.

        I am quite new to this so any help with this would be awesome!

  15. Tim

    I had this problem too. I had the php.ini file in the root folder. I moved it to the wp-admin folder, uploaded it and then rebooted the server. Then it worked.

  16. Me

    Hey Guys,

    SO if you have Media temple then the php.ini file is in your root directory under /etc (not under your wp admin for the one worpressfile)

  17. Coral

    this may be a very old thread, but it was helpful to me thanks – however, I did find that my hosting company has a PHP setting with a file upload max size that I think is overriding what is in my php.ini file – this may be why it is not refreshing for some of you as well.

    apologies if this has been said already

  18. AL

    1. I tried to download the php.ini file above and place it to wp-admin/(here). But it didn’t work.

    2. So I created a new file named php.ini with “upload_max_filesize = 32M
    post_max_size = 32M” inside, still didn’t work.

    3. Then I tried to edit .htaccess and add

    php_value upload_max_filesize 64M
    php_value post_max_size 96M

    it worked :D

  19. Site

    This helped me

    I searched for “.htaccess” and simply pasted this, none other solutions worked

    php_value upload_max_filesize 64M
    php_value post_max_size 64M
    php_value max_execution_time 300
    php_value max_input_time 300

  20. For those who still cannot do this. In your CPanel UI got to Software–>Select PHP Version. Here you can select a php version you currently have in the dropdown (Just make sure the version you select does not say default). Now you will see many checkboxes, and in the topright corner a link that says “Switch To PHP Options”. Click that link. There you will see the so called “upload_max_filesize = 80M
    post_max_size = 80M” options. Change them to your liking & save.

  21. Simon

    Hi Chris, thank you for the help. Your instructions worked for me. All others didn’t. I’ve been working on this problem for hours. Cheers!

  22. Frank

    None of this was working even after increasing the file size to 128MB! So, I uploaded the pro zip file to the wp-content/plugins and extracted it. Then I installed it through wordpress plugins. So far, so good.

Leave a Reply to Frode Børli Cancel reply