500th error when the file is downloaded in Wordpress from a string application



  • There's a client written on js. There's a photo download on the client. The client sends the file to REST-API wordpress. In the global $FILES, he shows up, but when I want to write it up at Uploads, when requested, he's making a mistake of 500 and fatal error.

    function image_test(WP_REST_Request $request){
    $data = $request->get_body();
    $overrides = ['test' => false];
    $result = wp_handle_upload(
        $_FILES['test'],
        $overrides
    );
    return "return"}
    


  • The problem is, these actions require rights. If you work with a client-serial architect, you need to find a solution for authorizing the client. In my case, this was decided by the installation of JWT Authentication for WP-API. It's just that the request in the heders has to be transmitted to the authorizing heder.


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2