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

Allow uploading images through TinyMCE image uploader! #2653

Merged
merged 4 commits into from
Mar 30, 2022

Conversation

tadhgboyle
Copy link
Member

@tadhgboyle tadhgboyle commented Mar 30, 2022

@Derkades What would be the standard here for returning the error header with the error text? Is what I have now okay?

Couple things to do:

  • Show error message in TinyMCE popup, not just "http error 500"
  • Token check

Deals with #2170 (can't see any open issues for it?)

@tadhgboyle tadhgboyle added this to the 2.0.0-pr13 milestone Mar 30, 2022
@Derkades
Copy link
Member

Derkades commented Mar 30, 2022

I'd change it to

if (!$upload) {
    http_response_code(500);
    die("Failed to upload image" . $image->getError());
}

and

http_response_code(400); // Bad request
die("No image uploaded");

Your current code tries to set the header "HTTP/1.1 500 Server Error" which doesn't make sense. The status code is sent before the headers in an HTTP response and messages belong in the response body.

@tadhgboyle tadhgboyle merged commit d22acc1 into v2 Mar 30, 2022
@tadhgboyle tadhgboyle deleted the feat/tinymce-image-upload branch March 30, 2022 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants