November 2017
Intermediate to advanced
420 pages
10h 29m
English
Let's build a REST API to store the image sent by the client. We will start with the client and then move on to the server-side implementation.
This example uses an HTML client to upload images to the REST API. When you make a POST request to the server, you have to encode the data that forms the body of the request. You can use the multipart/form-data encoding to deal with a large binary object uploaded via <input type="file">. The client-side HTML code may look like the following:
<html> <head> <title>File upload</title> <meta charset="UTF-8"> </head> <body> <form action="employees/100/image" method="post" enctype="multipart/form-data"> Choose photo for employee# 100 : <input type="file" ...