Upload image to wordpress using REST API

You can upload images just like your normal PHP/Wordpress file uploads.

Reference => wp_handle_upload

$mimes = array(
    'bmp'  => 'image/bmp',
    'gif'  => 'image/gif',
    'jpe'  => 'image/jpeg',
    'jpeg' => 'image/jpeg',
    'jpg'  => 'image/jpeg',
    'png'  => 'image/png',
    'tif'  => 'image/tiff',
    'tiff' => 'image/tiff'
);

$overrides = array(
    'mimes'     => $mimes,
    'test_form' => false
);

$upload = wp_handle_upload( $_FILES['YOUR_INPUT_FILE_NAME_HERE'], $overrides );
remove_filter( 'upload_dir', array($this, 'change_upload_dir') );
if ( isset( $upload['error'] ) ){
    // SOME UPLOAD ERROR OCCURED
} else {
    // File uploaded successfully. 
    $uploadedFileURL = $upload['url'];
    $uploadedFileName = basename($upload['url']);
}

And you can attach files in postman following way.

enter image description here