diff --git a/src/js/_enqueues/vendor/plupload/handlers.js b/src/js/_enqueues/vendor/plupload/handlers.js index 2e3125589558c..158ad427ccee2 100644 --- a/src/js/_enqueues/vendor/plupload/handlers.js +++ b/src/js/_enqueues/vendor/plupload/handlers.js @@ -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 ) { @@ -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' ); @@ -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(); }); diff --git a/src/js/_enqueues/vendor/plupload/wp-plupload.js b/src/js/_enqueues/vendor/plupload/wp-plupload.js index c0eb570657bf4..597149f22b186 100644 --- a/src/js/_enqueues/vendor/plupload/wp-plupload.js +++ b/src/js/_enqueues/vendor/plupload/wp-plupload.js @@ -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; } diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 42d42b3f8781d..a9e821ad1eab4 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -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. */