Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display media upload error message from server when one exists #7408

Closed
wants to merge 2 commits into from

Conversation

danielbachhuber
Copy link
Member

Description

If the server rejects a media upload and includes a message, display that message in the error UI.

Requires #7386
Fixes #7137

How has this been tested?

Add the following code snippet in functions.php or similar:

$force_upload_failure = function( $file ) {
	$file['error'] = 'This file upload has been forced to fail.';
	return $file;
};
add_filter( 'wp_handle_sideload_prefilter', $force_upload_failure );
add_filter( 'wp_handle_upload_prefilter', $force_upload_failure );

Attempt to upload an image into the image block. Observe This file upload has been forced to fail. as the error message.

Screenshots

image

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@danielbachhuber danielbachhuber added [Feature] Media Anything that impacts the experience of managing media REST API Interaction Related to REST API labels Jun 20, 2018
@danielbachhuber danielbachhuber added this to the 3.2 milestone Jun 20, 2018
@danielbachhuber danielbachhuber removed this from the 3.2 milestone Jun 21, 2018
@danielbachhuber danielbachhuber deleted the 7137-display-error branch June 21, 2018 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Media Anything that impacts the experience of managing media REST API Interaction Related to REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant