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.

This entry was posted in WordPress Tips. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

22 Comments

  1. Posted September 22, 2009 at 12:04 am | Permalink

    I just upped the memory limit on the linked php.ini file to 64MB. One of my sites was getting the error: “allowed memory size of 33554432 bytes exhausted”.

  2. Posted October 13, 2009 at 11:51 pm | Permalink

    hi,

    i think it is not a good idea to change directly to php.ini file. rather we can use ini_set() function to set php.ini directive.

    thanks,

    tahsin hasan.

  3. Posted February 17, 2010 at 10:00 pm | Permalink

    agree with @tahsin hasan

  4. Nikki
    Posted March 4, 2010 at 3:36 pm | Permalink

    Thanks for your help! Quick fix was just what I needed to be able to run some tests. :)

  5. Posted March 12, 2010 at 12:10 am | Permalink

    @tashin @Mr.Hyd

    Didn’t get your point

  6. Posted March 13, 2010 at 7:05 am | Permalink

    Hello Devin,

    I downloaded you PHP file and uploaded it to wp-admin but i’m still getting the same error when importing my posts. THanks!

  7. Posted March 13, 2010 at 2:30 pm | Permalink

    Are you using BlueHost? You may also need to upload the php.ini file into the root directory of your site (see step 6). Let us know if it works after that.

  8. Posted March 15, 2010 at 8:48 pm | Permalink

    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?

  9. Posted March 15, 2010 at 9:35 pm | Permalink

    @Devin

    I think you should not overlook some comments

  10. Posted March 15, 2010 at 9:44 pm | Permalink

    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??

  11. Posted March 15, 2010 at 11:13 pm | Permalink

    Hey Jeff. That’s too bad. Try using the WP Easy Uploader plug-in.

  12. Posted March 16, 2010 at 9:54 am | Permalink

    I haven’t been able to use the ini_set() with any success on BlueHost. If anyone else has been able to have this work, please post your steps.

  13. Posted April 1, 2010 at 12:30 pm | Permalink

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

  14. Posted April 5, 2010 at 11:28 pm | Permalink

    Thank you! After a long search, placing your php.ini file in my wp-admin folder was the simple solution to beating the 8mb upload limit I had run up against.

    Much appreciated.

  15. Posted April 10, 2010 at 7:28 pm | Permalink

    Thank you! After a long search, placing your php.ini file in my wp-admin folder was the simple solution to beating the 8mb upload limit I had run up against.

    Much appreciated.

  16. Posted April 15, 2010 at 7:55 pm | Permalink

    I’ve been trying to upload a 25-MB pdf file to the media library of my blog: http://ricehoppers.net but to no avail. I am hosted by Justhost. How can I increase the media upload limit to be able to upload a large file like a 25-MB pdf file of a book.

    Thanks for your help.

  17. Posted April 16, 2010 at 7:09 pm | Permalink

    Did these instructions not work for you? If not, you should call your host and explain the issue.

  18. Posted May 19, 2010 at 11:07 am | Permalink

    This worked marvelously for my real estate website, hosted by 1and1.com, when uploading a 4mb file. Thanks for this post!

  19. Posted June 11, 2010 at 4:42 pm | Permalink

    Thanks for that php.ini file. It worked brilliantly for importing my WordPress data!

  20. Posted July 31, 2010 at 4:08 am | Permalink

    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

  21. Posted August 21, 2010 at 1:37 pm | Permalink

    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.

  22. Posted August 23, 2010 at 4:20 pm | Permalink

    hey! thanks for this post I finally solved my client’s problem. :) Thanks!

Post a Comment

Your email is never published nor shared. 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>

Subscribe without commenting