Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/js/_enqueues/vendor/plupload/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ function switchUploader( s ) {
}
}

function uploadError( fileObj, errorCode, message, up ) {
function uploadError( fileObj, errorCode, message, up, errorObj ) {
var hundredmb = 100 * 1024 * 1024, max;

switch ( errorCode ) {
Expand Down Expand Up @@ -321,7 +321,11 @@ function uploadError( fileObj, errorCode, message, up ) {

break;
case plupload.HTTP_ERROR:
wpQueueError( pluploadL10n.http_error );
if ( errorObj && errorObj.status === 413 ) {
wpQueueError( pluploadL10n.http_error_413 );
} else {
wpQueueError( pluploadL10n.http_error );
}
break;
case plupload.INIT_ERROR:
jQuery( '.media-upload-form' ).addClass( 'html-uploader' );
Expand Down Expand Up @@ -643,7 +647,7 @@ jQuery( document ).ready( function( $ ) {
return;
}

uploadError( error.file, error.code, error.message, up );
uploadError( error.file, error.code, error.message, up, error );
up.refresh();
});

Expand Down
6 changes: 5 additions & 1 deletion src/js/_enqueues/vendor/plupload/wp-plupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,11 @@ window.wp = window.wp || {};
return pluploadL10n.file_exceeds_size_limit.replace( '%s', file.name );
},

'HTTP_ERROR': function( file ) {
'HTTP_ERROR': function( file, data ) {
if ( data && data.status === 413 ) {
return pluploadL10n.http_error_413;
}

if ( file.type && file.type.indexOf( 'image/' ) === 0 ) {
return pluploadL10n.http_error_image;
}
Expand Down
1 change: 1 addition & 0 deletions src/wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,7 @@ function wp_default_scripts( $scripts ) {
'missing_upload_url' => __( 'There was a configuration error. Please contact the server administrator.' ),
'upload_limit_exceeded' => __( 'You may only upload 1 file.' ),
'http_error' => __( 'Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.' ),
'http_error_413' => __( 'HTTP error 413. The server has rejected the upload because the request was too large. This is a server configuration limit and is separate from the maximum file size shown on this page. Please contact the site administrator.' ),
'http_error_image' => __( 'The server cannot process the image. This can happen if the server is busy or does not have enough resources to complete the task. Uploading a smaller image may help. Suggested maximum size is 2560 pixels.' ),
'upload_failed' => __( 'Upload failed.' ),
/* translators: 1: Opening link tag, 2: Closing link tag. */
Expand Down
Loading