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
This commit is contained in:
parent
98d7fb5e28
commit
780c0ec85b
@ -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 );
|
$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'] ) ) {
|
if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
|
||||||
echo json_encode( array(
|
echo json_encode( array(
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'message' => __( 'The uploaded file is not a valid image. Please try again.' ),
|
'data' => array(
|
||||||
'filename' => $_FILES['async-upload']['name'],
|
'message' => __( 'The uploaded file is not a valid image. Please try again.' ),
|
||||||
|
'filename' => $_FILES['async-upload']['name'],
|
||||||
|
)
|
||||||
) );
|
) );
|
||||||
|
|
||||||
wp_die();
|
wp_die();
|
||||||
@ -1615,9 +1617,11 @@ function wp_ajax_upload_attachment() {
|
|||||||
|
|
||||||
if ( is_wp_error( $attachment_id ) ) {
|
if ( is_wp_error( $attachment_id ) ) {
|
||||||
echo json_encode( array(
|
echo json_encode( array(
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'message' => $attachment_id->get_error_message(),
|
'data' => array(
|
||||||
'filename' => $_FILES['async-upload']['name'],
|
'message' => $attachment_id->get_error_message(),
|
||||||
|
'filename' => $_FILES['async-upload']['name'],
|
||||||
|
)
|
||||||
) );
|
) );
|
||||||
|
|
||||||
wp_die();
|
wp_die();
|
||||||
|
@ -790,7 +790,9 @@
|
|||||||
|
|
||||||
.media-uploader-status {
|
.media-uploader-status {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin: 0 auto;
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
|
max-width: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-sidebar .media-uploader-status {
|
.media-sidebar .media-uploader-status {
|
||||||
@ -842,7 +844,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.upload-errors .upload-error {
|
.upload-errors .upload-error {
|
||||||
max-width: 400px;
|
|
||||||
margin: 8px auto 0 auto;
|
margin: 8px auto 0 auto;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
border: 1px #c00 solid;
|
border: 1px #c00 solid;
|
||||||
@ -868,6 +869,7 @@
|
|||||||
display: block;
|
display: block;
|
||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
color: #b44;
|
color: #b44;
|
||||||
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uploader-window {
|
.uploader-window {
|
||||||
|
Loading…
Reference in New Issue
Block a user