Sounds like your JSON response have some additional output from PHP notices/warnings/errors.
On production site, its not recommended to have warnings/errors show up in output, so see if in your wp-config.php you have any of the two constants as true:
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );
Change them to false if they are true and see if that fixes it?
To fix the root cause: You would be able to look at what that is, if you inspect the response to that particular HTTP call in your browser. You can also check your PHP logs for the same.
After identifying the cause of that additional output, you can fix it and upload would start working correctly.
Thank you so much Ashish! This has really helped me pinpoint the problem. I’ll hopefully be able to fix it by the end of the day tomorrow.
I checked my php logs and got this error: DISALLOW_FILE_EDIT
I learned that error was being caused by this line of code being repeated in my WordPress file system define( ‘DISALLOW_FILE_EDIT’, true );
I found it in wp-config.php and functions.php and removed it from functions.php.
I thought this would fix it but now I’m getting this error: “Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.”
Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.
So did the media got uploaded despite the error? Or no?
Have you tried uploading a different file? Can you tell me what the file names were? Simple name “file.png” or “file.jpeg” is a good test to rule out any characters in file name that can cause a problem.
It would be worth looking at actual response of that http call in networks tab of browsers’ dev tools to see if it has some PHP notices/warnings output in it.
It did not. One file is “pic-header-e1571304962822.png” and the other is “undraw_working_late_pukg.svg”.
Okay, I’ll take a look at that and see what warning come up. Thanks