summaryrefslogtreecommitdiffstats
path: root/wp-admin/async-upload.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-03-19 12:35:25 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-03-19 12:35:25 +0000
commit50b00028bd207f461d6ed02f7868eccb5c6b8fe1 (patch)
tree003311f94f815dddbc39f91ba25b959f6ef18524 /wp-admin/async-upload.php
parent63f0f49bde74f02cdfc79140a7f101173f33322b (diff)
downloadwordpress-mu-50b00028bd207f461d6ed02f7868eccb5c6b8fe1.tar.gz
wordpress-mu-50b00028bd207f461d6ed02f7868eccb5c6b8fe1.tar.xz
wordpress-mu-50b00028bd207f461d6ed02f7868eccb5c6b8fe1.zip
Add and delete WP 2.5 files. *DON'T SVN UPDATE!*
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1214 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/async-upload.php')
-rw-r--r--wp-admin/async-upload.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/wp-admin/async-upload.php b/wp-admin/async-upload.php
new file mode 100644
index 0000000..c6350aa
--- /dev/null
+++ b/wp-admin/async-upload.php
@@ -0,0 +1,32 @@
+<?php
+
+/* This accepts file uploads from swfupload or other asynchronous upload methods.
+
+*/
+
+if ( defined('ABSPATH') )
+ require_once( ABSPATH . 'wp-config.php');
+else
+ require_once('../wp-config.php');
+
+// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
+if ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
+ $_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
+unset($current_user);
+require_once('admin.php');
+
+header('Content-Type: text/plain');
+
+if ( !current_user_can('upload_files') )
+ wp_die(__('You do not have permission to upload files.'));
+
+$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);
+
+?>