Index: wp-includes/class-wp-xmlrpc-server.php
===================================================================
--- wp-includes/class-wp-xmlrpc-server.php	(revision 19634)
+++ wp-includes/class-wp-xmlrpc-server.php	(working copy)
@@ -3088,6 +3088,10 @@
 		// Construct the attachment array
 		// attach to post_id 0
 		$post_id = 0;
+		if ( !empty( $data['post_id'] ) ) {
+			$post_id = (int) $data['post_id'];
+		}
+
 		$attachment = array(
 			'post_title' => $name,
 			'post_content' => '',

