Skip to content

Commit

Permalink
Provide a context to wp_handle_upload to differentiate between upload…
Browse files Browse the repository at this point in the history
… and sideload. props technosailor, fixes #12740.

git-svn-id: http://svn.automattic.com/wordpress/trunk@14418 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed May 3, 2010
1 parent 7ee7096 commit 248f4ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions wp-admin/includes/file.php
Expand Up @@ -344,7 +344,7 @@ function wp_handle_upload_error( &$file, $message ) {
if ( is_multisite() )
delete_transient( 'dirsize_cache' );

return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'upload' );
}

/**
Expand Down Expand Up @@ -484,7 +484,7 @@ function wp_handle_upload_error( &$file, $message ) {
// Compute the URL
$url = $uploads['url'] . "/$filename";

$return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
$return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ), 'sideload' );

return $return;
}
Expand Down
2 changes: 1 addition & 1 deletion xmlrpc.php
Expand Up @@ -2823,7 +2823,7 @@ function mw_newMediaObject($args) {
$id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );

return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ) );
return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ), 'upload' );
}

/* MovableType API functions
Expand Down

0 comments on commit 248f4ab

Please sign in to comment.