diff -r 53cff4b4a802 -r bde1974c263b web/wp-admin/includes/import.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-admin/includes/import.php Wed Feb 03 15:37:20 2010 +0000 @@ -0,0 +1,92 @@ + false, 'test_type' => false ); + $_FILES['import']['name'] .= '.txt'; + $file = wp_handle_upload( $_FILES['import'], $overrides ); + + if ( isset( $file['error'] ) ) + return $file; + + $url = $file['url']; + $type = $file['type']; + $file = addslashes( $file['file'] ); + $filename = basename( $file ); + + // Construct the object array + $object = array( 'post_title' => $filename, + 'post_content' => $url, + 'post_mime_type' => $type, + 'guid' => $url + ); + + // Save the data + $id = wp_insert_attachment( $object, $file ); + + return array( 'file' => $file, 'id' => $id ); +} + +?>