Make WordPress Core

Changeset 34002


Ignore:
Timestamp:
09/10/2015 05:17:22 PM (9 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/media-new.php

    r32974 r34002  
    2626
    2727if ( $_POST ) {
    28     $location = 'upload.php';
    2928    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
    3029        check_admin_referer('media-form');
    3130        // Upload File button was clicked
    32         $id = media_handle_upload( 'async-upload', $post_id );
    33         if ( is_wp_error( $id ) )
    34             $location .= '?message=3';
     31        $upload_id = media_handle_upload( 'async-upload', $post_id );
     32        if ( is_wp_error( $upload_id ) ) {
     33            wp_die( $upload_id );
     34        }
    3535    }
    36     wp_redirect( admin_url( $location ) );
     36    wp_redirect( admin_url( 'upload.php' ) );
    3737    exit;
    3838}
Note: See TracChangeset for help on using the changeset viewer.