set_file_params example

if ( isset( $_SERVER['PATH_INFO'] ) ) {
                $path = $_SERVER['PATH_INFO'];
            } else {
                $path = '/';
            }
        }

        $request = new WP_REST_Request( $_SERVER['REQUEST_METHOD']$path );

        $request->set_query_params( wp_unslash( $_GET ) );
        $request->set_body_params( wp_unslash( $_POST ) );
        $request->set_file_params( $_FILES );
        $request->set_headers( $this->get_headers( wp_unslash( $_SERVER ) ) );
        $request->set_body( self::get_raw_data() );

        /* * HTTP method override for clients that can't use PUT/PATCH/DELETE. First, we check * $_GET['_method']. If that is not set, we check for the HTTP_X_HTTP_METHOD_OVERRIDE * header. */
        if ( isset( $_GET['_method'] ) ) {
            $request->set_method( $_GET['_method'] );
        } elseif ( isset( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ) ) {
            
Home | Imprint | This part of the site doesn't use cookies.