• I’m having trouble uploading images using the WordPress editor or Elementor. I get the error, “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”. The images I’m trying to upload are only 41 KB or 193 KB.

    I’ve also tried uploading images using the multi-file uploader and I get the error: “The response is not a valid Json response”.

    I am able to upload images when I switch to using the browser uploader. I can then switch back to the multi-file uploader, which works as does the WordPress and Elementor editors. However, this workaround is not permanent and goes back to giving those errors after being logged for a period of time.

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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.

    Thread Starter prometheus512

    (@prometheus512)

    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.

    Thread Starter prometheus512

    (@prometheus512)

    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.

    Thread Starter prometheus512

    (@prometheus512)

    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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Receiving JSON error when trying to upload images’ is closed to new replies.