Wordpress Amateur Hour: enabling large file uploads with upload_max_filesize

This was a minor odyssey - I’m trying to import a Wordpress Export/XML file to this blog, yet the file size of 2.8MB exceeds the built-in limit of 2MB. Apparently this was included as a bandwidth hedge for hosters of some kind.

Judging by the amount of Google hits on “upload_max_filesize wordpress” it’s apparent this isn’t a simple fix.

In any case, the answers start with “Change your php.ini file” followed with “if that doesn’t work, change your .htaccess file”. The latter is often suggested as some hosters don’t allow you to edit php.ini. Mine (BlueHost) does, as confirmed via a quick live support chat tonight.

So great, I can edit php.ini - and I need to change this line:

upload_max_filesize = 2M

to

upload_max_filesize = 10M

or whatever your desired max upload file size is. “M” = Megs. You also need to add, right below the above, on its own line:

post_max_size = 20M

Again, edit the # to whatever you need, though it apparently needs to be larger than the upload_max_filesize #.

But I have several php.ini files, and none seem to make the change work!

Ah, so the clincher in a Wordpress install, for me at least - WHICH php.ini file needs to be edited? You may have several -> at your www root, inside your WP install, etc. In my quest, it turns out NONE worked - but the help text from my hoster included in the php.ini file (any of them - all were the same) noted that I needed to copy over a php.ini file into whatever folder held my upload script, aka “upload.php”.

In Wordpress, that means wp-admin folder. So the solution, in short:

  1. Confirm you can in fact access/edit your php.ini files. Assuming yes (if no, go see this article referencing the .htaccess bit), then
  2. Copy/duplicate the php.ini file that sits in your Wordpress install’s root folder.
  3. Move the copy to wp-admin
  4. Rename it back to php.ini
  5. Add in the above code
  6. Save

No guarantees whatsoever, but it worked for me! If you are all all nervous about playing with some of your core Wordpress or hoster files, I’d probably hop over to your hoster’s support forums first.

4 Responses to “Wordpress Amateur Hour: enabling large file uploads with upload_max_filesize”

  1. » Wordpress Amateur Hour: enabling large file uploads with … Says:

    [...] can read the rest of this blog post by going to the original source, here [...]

  2. Infinitely Overjoyed Says:

    You, sir, have saved my bacon from the wrath of my Irish priest with this advice! (Okay, I’m kidding about wrath…kinda. Heh.) I’m moving our parish website over to WordPress forced into a static page kinda configuration, and it seemed like there was no way on this Earth that I was going to be able to HTTP our audio sermons to the site. It never occurred to me that upload.php was the active file in all of this for some reason.

    All of this to say that you rawk and I get to make Father happy. The world is well. Thanks so much!! :-)

  3. Kevin Says:

    @Infinitely - haha, glad I could help. :) That’s why I wrote this, as I figured if it took me 10 hours or so of painful hunting online, others must be in the same boat.

  4. KODIWEERA Says:

    Great!. It worked for me too. I copied php.ini file to wordpress admin folder and problem solved.
    Thank you Kevin.

Leave a Reply