From 780c0ec85b9c479e615a4d01527ac8e4b2753edb Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 30 Nov 2012 15:40:09 +0000 Subject: [PATCH] Properly pass WordPress uploading errors to wp.Uploader. Props koopersmith fixes #22655 git-svn-id: https://develop.svn.wordpress.org/trunk@22954 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/ajax-actions.php | 16 ++++++++++------ wp-includes/css/media-views.css | 4 +++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 6be0c86550..a6a37b6f98 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -1602,9 +1602,11 @@ function wp_ajax_upload_attachment() { $wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'], false ); if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) { echo json_encode( array( - 'success' => false, - 'message' => __( 'The uploaded file is not a valid image. Please try again.' ), - 'filename' => $_FILES['async-upload']['name'], + 'success' => false, + 'data' => array( + 'message' => __( 'The uploaded file is not a valid image. Please try again.' ), + 'filename' => $_FILES['async-upload']['name'], + ) ) ); wp_die(); @@ -1615,9 +1617,11 @@ function wp_ajax_upload_attachment() { if ( is_wp_error( $attachment_id ) ) { echo json_encode( array( - 'success' => false, - 'message' => $attachment_id->get_error_message(), - 'filename' => $_FILES['async-upload']['name'], + 'success' => false, + 'data' => array( + 'message' => $attachment_id->get_error_message(), + 'filename' => $_FILES['async-upload']['name'], + ) ) ); wp_die(); diff --git a/wp-includes/css/media-views.css b/wp-includes/css/media-views.css index f350c816e3..d42edf1ad0 100644 --- a/wp-includes/css/media-views.css +++ b/wp-includes/css/media-views.css @@ -790,7 +790,9 @@ .media-uploader-status { position: relative; + margin: 0 auto; padding-bottom: 10px; + max-width: 400px; } .media-sidebar .media-uploader-status { @@ -842,7 +844,6 @@ } .upload-errors .upload-error { - max-width: 400px; margin: 8px auto 0 auto; padding: 8px; border: 1px #c00 solid; @@ -868,6 +869,7 @@ display: block; padding-top: 8px; color: #b44; + word-wrap: break-word; } .uploader-window {