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'm a WordPress developer based in Austin, Texas. Follow my projects on GitHub, or more general WordPress ramblings as @devinsays on twitter.

136 thoughts on “Increasing the upload_max_filesize in WordPress

  1. Ivain wrote:

    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 wrote:

    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?

    • James wrote:

      I just got the same error as Paul?


  3. Stef wrote:

    I just copied and pasted your php.ini file and it worked.

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>