Index: wp-admin/includes/export.php
===================================================================
--- wp-admin/includes/export.php	(revision 20606)
+++ wp-admin/includes/export.php	(working copy)
@@ -32,6 +32,8 @@
 
 	do_action( 'export_wp' );
 
+	$get_attachments = false;
+
 	$sitename = sanitize_key( get_bloginfo( 'name' ) );
 	if ( ! empty($sitename) ) $sitename .= '.';
 	$filename = $sitename . 'wordpress.' . date( 'Y-m-d' ) . '.xml';
@@ -46,6 +48,7 @@
 			$args['content'] = 'post';
 
 		$where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] );
+		$get_attachments = true;
 	} else {
 		$post_types = get_post_types( array( 'can_export' => true ) );
 		$esses = array_fill( 0, count($post_types), '%s' );
@@ -79,6 +82,14 @@
 	// grab a snapshot of post IDs, just in case it changes during the export
 	$post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" );
 
+	if ( $get_attachments ) {
+		$attachment_ids = $wpdb->get_col( "SELECT ID
+			FROM {$wpdb->posts}
+			WHERE {$wpdb->posts}.post_type ='attachment'
+			AND {$wpdb->posts}.post_parent IN (".implode(',', $post_ids).")" );
+		$post_ids = array_merge($post_ids, $attachment_ids);
+	}
+
 	// get the requested terms ready, empty unless posts filtered by category or all content
 	$cats = $tags = $terms = array();
 	if ( isset( $term ) && $term ) {
