media-new.php, when using the browser uploader, if the result of uploading is a WP_Error - wp_die() with the error, instead of redirecting with a generic error.

Props solarissmoke.
Fixes #16820. 


git-svn-id: https://develop.svn.wordpress.org/trunk@34002 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-09-10 17:17:22 +00:00
parent ad163d3547
commit 7178b67671

View File

@ -25,15 +25,15 @@ if ( isset( $_REQUEST['post_id'] ) ) {
}
if ( $_POST ) {
$location = 'upload.php';
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
check_admin_referer('media-form');
// Upload File button was clicked
$id = media_handle_upload( 'async-upload', $post_id );
if ( is_wp_error( $id ) )
$location .= '?message=3';
$upload_id = media_handle_upload( 'async-upload', $post_id );
if ( is_wp_error( $upload_id ) ) {
wp_die( $upload_id );
}
}
wp_redirect( admin_url( $location ) );
wp_redirect( admin_url( 'upload.php' ) );
exit;
}