* @subpackage Administration
*/
+if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
+ define( 'DOING_AJAX', true );
+}
+
define('WP_ADMIN', true);
if ( defined('ABSPATH') )
require_once(ABSPATH . 'wp-load.php');
else
- require_once('../wp-load.php');
+ require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
if ( ! ( isset( $_REQUEST['action'] ) && 'upload-attachment' == $_REQUEST['action'] ) ) {
// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
unset($current_user);
}
-require_once('./admin.php');
+require_once( ABSPATH . 'wp-admin/admin.php' );
if ( !current_user_can('upload_files') )
wp_die(__('You do not have permission to upload files.'));
header('Content-Type: text/html; charset=' . get_option('blog_charset'));
if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
- define( 'DOING_AJAX', true );
include ABSPATH . 'wp-admin/includes/ajax-actions.php';
send_nosniff_header();
} else {
// long form response - big chunk o html
$type = $_REQUEST['type'];
- echo apply_filters("async_upload_{$type}", $id);
+
+ /**
+ * Filter the returned ID of an uploaded attachment.
+ *
+ * The dynamic portion of the hook name, $type, refers to the attachment type,
+ * such as 'image', 'audio', 'video', 'file', etc.
+ *
+ * @since 2.5.0
+ *
+ * @param int $id Uploaded attachment ID.
+ */
+ echo apply_filters( "async_upload_{$type}", $id );
}