Site icon Hip-Hop Website Design and Development

Upload User Avatar from android to WordPress using Rest API

I am developing an android app that give users ability to browse , register, login, post and comment to my wordpress blog using Rest Api .

I am trying now to add a way for users to update their avatars , but i have no idea how to upload media to my blog


add_action('rest_api_init', function () {

  register_rest_route( 'wp/v2', 'upload_image/',array(
                'methods'  => 'POST',
                'callback' => 'upload_image' )); });


function upload_image( $path ) {

    // NO IDEA HERE

}