From cf9f85dc8121a359d550ffa3b735fb48859eee88 Mon Sep 17 00:00:00 2001 From: donncha Date: Thu, 24 Apr 2008 11:45:39 +0000 Subject: Merged with WP 2.5, revision 7806 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1260 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/async-upload.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'wp-admin/async-upload.php') diff --git a/wp-admin/async-upload.php b/wp-admin/async-upload.php index c6350aa..1a37dce 100644 --- a/wp-admin/async-upload.php +++ b/wp-admin/async-upload.php @@ -20,13 +20,26 @@ header('Content-Type: text/plain'); if ( !current_user_can('upload_files') ) wp_die(__('You do not have permission to upload files.')); +// just fetch the detail form for that attachment +if ( ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) { + echo get_media_item($id); + exit; +} + $id = media_handle_upload('async-upload', $_REQUEST['post_id']); if (is_wp_error($id)) { echo '
'.wp_specialchars($id->get_error_message()).'
'; exit; } -$type = $_REQUEST['type']; -echo apply_filters("async_upload_{$type}", $id); +if ( $_REQUEST['short'] ) { + // short form response - attachment ID only + echo $id; +} +else { + // long form response - big chunk o html + $type = $_REQUEST['type']; + echo apply_filters("async_upload_{$type}", $id); +} ?> -- cgit