*** xmlrpc.php.orig	2008-03-15 04:08:09.000000000 +0900
--- xmlrpc.php	2008-04-01 16:35:48.000000000 +0900
***************
*** 1886,1891 ****
--- 1886,1894 ----
  			logIO('O', '(MW) ' . $errorString);
  			return new IXR_Error(500, $errorString);
  		}
+ 
+ 		$file = apply_filters( 'wp_handle_upload', array( 'file' => $upload[ 'file' ], 'url' => $upload[ 'url' ], 'type' => $type ) );
+ 
  		// Construct the attachment array
  		// attach to post_id -1
  		$post_id = -1;
***************
*** 1894,1908 ****
  			'post_content' => '',
  			'post_type' => 'attachment',
  			'post_parent' => $post_id,
! 			'post_mime_type' => $type,
! 			'guid' => $upload[ 'url' ]
  		);
  
  		// Save the data
! 		$id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
! 		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
  
! 		return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ) );
  	}
  
  
--- 1897,1911 ----
  			'post_content' => '',
  			'post_type' => 'attachment',
  			'post_parent' => $post_id,
! 			'post_mime_type' => $file[ 'type' ],
! 			'guid' => $file[ 'url' ]
  		);
  
  		// Save the data
! 		$id = wp_insert_attachment( $attachment, $file[ 'file' ], $post_id );
! 		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file['file'] ) );
  
! 		return $file;
  	}
  
  
