summaryrefslogtreecommitdiffstats
path: root/wp-admin/async-upload.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-04-24 11:45:39 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-04-24 11:45:39 +0000
commitcf9f85dc8121a359d550ffa3b735fb48859eee88 (patch)
tree9f90be15fc46163f5656f019f2a2866414b7c9f2 /wp-admin/async-upload.php
parentf10f9f5b05e23ce4c07479b094bd3ff4bbfd86d0 (diff)
downloadwordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.tar.gz
wordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.tar.xz
wordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.zip
Merged with WP 2.5, revision 7806
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1260 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/async-upload.php')
-rw-r--r--wp-admin/async-upload.php17
1 files changed, 15 insertions, 2 deletions
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 '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>';
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);
+}
?>