How to Import a Large WordPress XML File and Override the Default Limits

WordPress Blog - iconWordPress has a function in the administration area where you can export your blog content and import them unto a new blog installation. That works fine as is if you are importing a small file. However, when your file is larger than 2MB, the problem starts. The default limit for uploading an XML import file via the WordPress admin area is 2MB. Here’s a way to override that limit using htaccess.

First, open Notepad (or a text editor) to create a file and name it “.htaccess”

Upload this .htaccess file into the root directory of your server (where your site resides).

Cut and paste the code below into the .htaccess file:

#set max upload file size
php_value upload_max_filesize xxM

#set max post size
php_value post_max_size xxM

Change the “xx” variable to a number that meets your requirements. For example, my latest client needed me to import a 28MB XML file, so I just went ahead and changed the “xx” variable to 48. I was then able to import the WordPress XML file successfully.

Here’s what the final .htaccess file looks like:

#set max upload file size
php_value upload_max_filesize 48M

#set max post size
php_value post_max_size 48M

Hope this solution works out for you!

*If you need help with your WordPress blogs, just contact me with your project requirements. I’ll then respond with a quote accordingly.

→ Posted in Category: Tutorials

Share This Post:
  • Google
  • Facebook
  • MySpace
  • Live
  • YahooMyWeb
  • StumbleUpon
  • Digg
  • Technorati
  • del.icio.us
  • Mixx
  • BlinkList
  • E-mail this story to a friend!
  • Faves
  • Spurl
  • Yahoo! Buzz
  • LinkedIn
  • blinkbits
  • Blogosphere News
  • De.lirio.us
  • Furl
  • Internetmedia
  • NewsVine
  • Reddit
  • description
  • Simpy
  • Taggly
  • TwitThis



Here's where you can leave a comment regarding the above post.

12 Responses to “How to Import a Large WordPress XML File and Override the Default Limits”

  1. Comment by Prince Vasquez on May 1st, 2009 7:39 pm

    Hi,

    I am having errors after uploading the edited .htaccess file

    import.php gives out 500 message error.

    Any ideas?

  2. Comment by After5PC on May 3rd, 2009 11:35 pm

    Does your server support htaccess files? Some servers don’t allow htaccess to run. If your server supports htaccess, have you checked the file permission settings after uploading the file? CHMOD file permission of your htaccess file to 644 and try again.

  3. Comment by William Eisner on May 28th, 2009 2:29 pm

    I found your article and attempted to use it to fix my problem with WPMU.

    When attempting to upload an rss file smaller than 2MB, I get the “This file is to big. Files must be less than 120kb in size” response from the WPMU interface.

    I am looking for the restraint that is causing this issue.

    I have so far made modifications to:
    php.ini, admin.php, import.php,rss.php

    I am at a loss and would be greatly appreciative of any help you might provide in resolving this issue.

    Thank you for your assistance.

    William Eisner
    W.E. Enterprises/www.businessonahost.com

  4. Comment by After5PC on June 15th, 2009 10:39 pm

    Hi William,

    Sorry for the delayed response. I had been out of town and just got back…

    Has your problem been resolved?

    Try using the .htaccess solution and see if that works.

  5. Comment by eric on August 26th, 2009 12:32 pm

    wow that worked so simply!
    thanks

    wonder why wordpress wouldn’t let you upload larger files…

  6. Comment by Honey Singh on September 8th, 2009 1:12 am

    Thanks for the suggestions and information’s,
    initially i used to do so via php.ini files.
    Now i implement the necessary changes in .htaccess files . :P

  7. Comment by Rob Scott on November 4th, 2009 5:45 pm

    There’s every chance you’ll find it timing out at that large a size – might as well edit php.ini.

  8. Comment by April on November 19th, 2009 9:57 pm

    I’m having issues as well, and I’ve tried to add the file, I’m wondering if you can help me with it?

  9. Comment by Amanda on February 1st, 2010 12:56 am

    that is not working for me. Please help!

  10. Comment by After5PC on February 1st, 2010 8:44 am

    Amanda,

    Does your server support htaccess?
    If not, there are other ways to transfer your data.

    -Bryan
    After5PC.net

  11. Comment by Michale Sacca on February 9th, 2010 2:16 am

    Thank you – that worked perfectly.

  12. Comment by ArtLung : Migrating an old Blogger blog to WordPress ~ 02 Mar 2010 on March 2nd, 2010 11:19 am

    [...] If the file is too large, then you can try overriding the various file upload limits under PHP, and WordPress: How to Import a Large WordPress XML File and Override the Default Limits [...]

Leave a Reply



(optional)

Your comment: