Wordpress can't upload a file using the native file uploader when editing media

408 Views Asked by At

When editing a post on Wordpress, I am attempting to upload an image from the Edit post screen. a small Image icon opens the pane which gives me three options: Upload, Media Library, Insert from URL. it looks like this:

enter image description here

When I choose Upload, and choose an image, I get

enter image description here

Unfortunately, for me, this is caused by the upload endpoint returning bad content. it seems to return BOTH an HTML redirection notice (not a real redirect, just a notice telling the user the media has moved), and then it contains the JSON response AFTEr the close of the body tag.

see both pictures

enter image description here

Notice that after the redirection notification there's the JSON for the media that was just created.

enter image description here

I am on Wordpress 5.3.2 and I am using the "WP Offload Media Lite" plugin which might be related but in fact I saw the problem when the plugin was not installed so I think it might not be related.

I am using only a basic set of other plugins, like Akismet, Contact Form, Insert Headers & footers, and WP Mail SMTP. I have only a basic theme chosen (but I don't think that's the problem)

1

There are 1 best solutions below

0
On

some answers I found on the internet

• this person suggests problems happen when your media filename have spaces

https://www.quora.com/How-do-I-solve-the-response-is-not-a-valid-JSON-response-in-WordPress

• This Wordpress support topic is closed for commenting and offers no solution other than use the Health check, which does me no good

https://wordpress.org/support/topic/the-response-is-not-a-valid-json-response-2/

• This non-developer WordPress user suggests some work-arounds which are simply to use the other way to upload media into your WordPress site:

https://navinrao.com/the-response-is-not-a-valid-json-response

these might be good answers but it seems to me the problem is a bug