• Hi,

    tl;dr version: Attachment import isn’t working (displaying a Failed to import “media file name” error) and none of the usual fixes are resolving the issue.

    I have a site that is shutting down and I’m trying to import the content into a new site.

    However, a lot of the media is failing to import. This seems like a fairly common issue, with plenty available on this forum but none of the fixes seem to have worked. To clarify, these are the steps I’ve taken:

    1. I have ensured I’m exporting “all content” when creating the XML.
    2. I have ensured “Download and import file attachments” is selected when importing the file into the new site
    3. I have ensured the XML file is within the 50MB limit imposed by WordPress
    4. I have added the following lines to my wp-config.php file to increase the amount of memory available to PHP:
      define('WP_MEMORY_LIMIT', '600M');
      define( 'WP_MAX_MEMORY_LIMIT', '600M' );
    5. I have had my hosting provider change the line in PHP.ini where line shows 32M to 256M: memory_limit = 256M; Maximum amount of memory a script may consume (64MB)
    6. I have disabled all plugins
    7. I have tried regenerating the XML file from the original site

    Variations of those seem to be the suggestions that have fixed it for everyone else.

    What happens when I import is that all of the posts, pages, categories and tags import. Several of the images do import onto the new server and display correctly but most either

    • Fail and do not import at all or,
    • Hotlink the images from the original site

    I have verified that the files that are failing are in the XML and they appear to be formed correctly and identically to the files that are not failing.

    For example, here is an image that is not failing:

    <item>
    		<title>the-lone-ranger-and-tonto-halloween-costume</title>
    		<link>https://www.oldsite.com/lol/5-halloween-costumes-you-can-use-right-now/attachment/the-lone-ranger-and-tonto-halloween-costume/</link>
    		<pubDate>Wed, 22 Oct 2014 21:42:56 +0000</pubDate>
    		<dc:creator><![CDATA[andrewmorgan]]></dc:creator>
    		<guid isPermaLink="false">https://www.oldsite.com/wp-content/uploads/2014/10/the-lone-ranger-and-tonto-halloween-costume.jpg</guid>
    		<description></description>
    		<content:encoded><![CDATA[]]></content:encoded>
    		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
    		<wp:post_id>430</wp:post_id>
    		<wp:post_date>2014-10-22 22:42:56</wp:post_date>
    		<wp:post_date_gmt>2014-10-22 21:42:56</wp:post_date_gmt>
    		<wp:comment_status>open</wp:comment_status>
    		<wp:ping_status>open</wp:ping_status>
    		<wp:post_name>the-lone-ranger-and-tonto-halloween-costume</wp:post_name>
    		<wp:status>inherit</wp:status>
    		<wp:post_parent>426</wp:post_parent>
    		<wp:menu_order>0</wp:menu_order>
    		<wp:post_type>attachment</wp:post_type>
    		<wp:post_password></wp:post_password>
    		<wp:is_sticky>0</wp:is_sticky>
    		<wp:attachment_url>https://www.oldsite.com/wp-content/uploads/2014/10/the-lone-ranger-and-tonto-halloween-costume.jpg</wp:attachment_url>
    		<wp:postmeta>
    			<wp:meta_key>_wp_attachment_image_alt</wp:meta_key>
    			<wp:meta_value><![CDATA[the lone ranger and tonto halloween costume]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key>_wp_attached_file</wp:meta_key>
    			<wp:meta_value><![CDATA[2014/10/the-lone-ranger-and-tonto-halloween-costume.jpg]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key>_wp_attachment_metadata</wp:meta_key>
    			<wp:meta_value><![CDATA[a:5:{s:5:"width";i:620;s:6:"height";i:400;s:4:"file";s:55:"2014/10/the-lone-ranger-and-tonto-halloween-costume.jpg";s:5:"sizes";a:7:{s:9:"thumbnail";a:4:{s:4:"file";s:55:"the-lone-ranger-and-tonto-halloween-costume-150x150.jpg";s:5:"width";i:150;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:55:"the-lone-ranger-and-tonto-halloween-costume-300x194.jpg";s:5:"width";i:300;s:6:"height";i:194;s:9:"mime-type";s:10:"image/jpeg";}s:14:"post-thumbnail";a:4:{s:4:"file";s:55:"the-lone-ranger-and-tonto-halloween-costume-620x400.jpg";s:5:"width";i:620;s:6:"height";i:400;s:9:"mime-type";s:10:"image/jpeg";}s:10:"post-thumb";a:4:{s:4:"file";s:55:"the-lone-ranger-and-tonto-halloween-costume-620x400.jpg";s:5:"width";i:620;s:6:"height";i:400;s:9:"mime-type";s:10:"image/jpeg";}s:12:"medium-thumb";a:4:{s:4:"file";s:55:"the-lone-ranger-and-tonto-halloween-costume-300x194.jpg";s:5:"width";i:300;s:6:"height";i:194;s:9:"mime-type";s:10:"image/jpeg";}s:12:"square-thumb";a:4:{s:4:"file";s:55:"the-lone-ranger-and-tonto-halloween-costume-240x225.jpg";s:5:"width";i:240;s:6:"height";i:225;s:9:"mime-type";s:10:"image/jpeg";}s:11:"small-thumb";a:4:{s:4:"file";s:53:"the-lone-ranger-and-tonto-halloween-costume-85x54.jpg";s:5:"width";i:85;s:6:"height";i:54;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:11:{s:8:"aperture";i:0;s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";i:0;s:9:"copyright";s:0:"";s:12:"focal_length";i:0;s:3:"iso";i:0;s:13:"shutter_speed";i:0;s:5:"title";s:0:"";s:11:"orientation";i:0;}}]]></wp:meta_value>
    		</wp:postmeta>
    	</item>

    And here is an image that is failing:

    <item>
    		<title></title>
    		<link>https://www.oldsite.com/cool/what-happens-when-football-boots-meet-transformers/attachment/footballboottransformers22/</link>
    		<pubDate>Mon, 26 Oct 2015 18:08:17 +0000</pubDate>
    		<dc:creator><![CDATA[alasdair-jessup]]></dc:creator>
    		<guid isPermaLink="false">https://www.oldsite.com/wp-content/uploads/2015/10/footballboottransformers22.jpg</guid>
    		<description></description>
    		<content:encoded><![CDATA[]]></content:encoded>
    		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
    		<wp:post_id>2932</wp:post_id>
    		<wp:post_date>2015-10-26 18:08:17</wp:post_date>
    		<wp:post_date_gmt>2015-10-26 18:08:17</wp:post_date_gmt>
    		<wp:comment_status>open</wp:comment_status>
    		<wp:ping_status>closed</wp:ping_status>
    		<wp:post_name>footballboottransformers22</wp:post_name>
    		<wp:status>inherit</wp:status>
    		<wp:post_parent>2924</wp:post_parent>
    		<wp:menu_order>0</wp:menu_order>
    		<wp:post_type>attachment</wp:post_type>
    		<wp:post_password></wp:post_password>
    		<wp:is_sticky>0</wp:is_sticky>
    		<wp:attachment_url>https://www.oldsite.com/wp-content/uploads/2015/10/footballboottransformers22.jpg</wp:attachment_url>
    		<wp:postmeta>
    			<wp:meta_key>_wp_attached_file</wp:meta_key>
    			<wp:meta_value><![CDATA[2015/10/footballboottransformers22.jpg]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key>_wp_attachment_metadata</wp:meta_key>
    			<wp:meta_value><![CDATA[a:5:{s:5:"width";i:600;s:6:"height";i:400;s:4:"file";s:38:"2015/10/footballboottransformers22.jpg";s:5:"sizes";a:7:{s:9:"thumbnail";a:4:{s:4:"file";s:38:"footballboottransformers22-150x150.jpg";s:5:"width";i:150;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:38:"footballboottransformers22-300x194.jpg";s:5:"width";i:300;s:6:"height";i:194;s:9:"mime-type";s:10:"image/jpeg";}s:14:"post-thumbnail";a:4:{s:4:"file";s:38:"footballboottransformers22-600x400.jpg";s:5:"width";i:600;s:6:"height";i:400;s:9:"mime-type";s:10:"image/jpeg";}s:10:"post-thumb";a:4:{s:4:"file";s:38:"footballboottransformers22-600x400.jpg";s:5:"width";i:600;s:6:"height";i:400;s:9:"mime-type";s:10:"image/jpeg";}s:12:"medium-thumb";a:4:{s:4:"file";s:38:"footballboottransformers22-300x194.jpg";s:5:"width";i:300;s:6:"height";i:194;s:9:"mime-type";s:10:"image/jpeg";}s:12:"square-thumb";a:4:{s:4:"file";s:38:"footballboottransformers22-240x225.jpg";s:5:"width";i:240;s:6:"height";i:225;s:9:"mime-type";s:10:"image/jpeg";}s:11:"small-thumb";a:4:{s:4:"file";s:36:"footballboottransformers22-85x54.jpg";s:5:"width";i:85;s:6:"height";i:54;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:11:{s:8:"aperture";i:0;s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";i:0;s:9:"copyright";s:0:"";s:12:"focal_length";i:0;s:3:"iso";i:0;s:13:"shutter_speed";i:0;s:5:"title";s:0:"";s:11:"orientation";i:0;}}]]></wp:meta_value>
    		</wp:postmeta>
    		<wp:postmeta>
    			<wp:meta_key>_wp_attachment_image_alt</wp:meta_key>
    			<wp:meta_value><![CDATA[footballboottransformers22]]></wp:meta_value>
    		</wp:postmeta>
    	</item>

    If anyone has any ideas, I would be most grateful as I’ve spent the last 7 hours trying to resolve it without success!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter hydraglyph

    (@hydraglyph)

    Update:

    I’ve also completed the following steps (sadly, without positive results):

    • Restored the WordPress core files
    • Restored the .htaccess file
    Thread Starter hydraglyph

    (@hydraglyph)

    Just giving this a bump as I enter day two of trying to solve this problem.

    Thread Starter hydraglyph

    (@hydraglyph)

    Update:

    I have tried the following additional steps, also sadly without managing to solve the problem:

    • Installed the theme from the source site onto the destination site, to eliminate any potential theme conflicts.
    • Changed permissions on the “uploads” folder from 755 to 777.
    • Manually copied all media from the source site’s “uploads” folder to the desination site’s “uploads” folder before attempting an import.

    I’m now at a complete loss as I can’t think of any other troubleshooting steps.

    Thread Starter hydraglyph

    (@hydraglyph)

    Update:

    I have tried importing the XML into a completely fresh, completely separate WordPress install and the same items are failing, so it appears the problem is with the XML itself.

    Try adding in wp-config.php

    define('IMPORT_DEBUG', true);

    And run again the importer, it should tell you why.

    HRMC

    (@touchgrove)

    To migrate a site I would recommend bypassing the WordPress importer/exporter altogether and using Blogvault instead. If you have control over FTP / admin access on both the old site and the new, this is your best bet. It works flawlessly.

    qboulevard

    (@qboulevard)

    Can you tell me what blogvault is and where to find it? Is it a plugin? Can you provide a link and further explanation?

    vanex

    (@vanex)

    Hi, I had the same problem trying to export/import all contents from one site to a new one.
    7zip the XML file didn’t work.
    In the end I did:
    – downloaded from the old site the wp-content\uploads directory to local disk
    – uploaded the wp-content\uploads directory to the new site
    – exported the content from the old site via WP “tool” + “export”
    – edited the XML file and changed the http:\\oldsite.com in http:\\newsite.com
    – imported the XML file via WP “tool” + “import” (WP run importer)

    It works ??

    Ah … Blogvault is a plugin but it is not for free …

    qboulevard

    (@qboulevard)

    I can’t do that. There’s no directory because I am migrating from a wordpress dot com site. I can’t access the files if it’s from dot com. I can export using the export tool, which I have tried multiple times. i have the images in my media content in the new site finally, but most images are not attached to posts as they were in the old site.

    I want to ask where do I change the site name? In the filename? or within the xml file?

    qboulevard

    (@qboulevard)

    I, too, found that blog vault was too expensive. I also have the option of asking the wordpress dot com people to do it for me for a very high price. This is very frustrating.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘WordPress Failed To Import Media’ is closed to new replies.