How it works...
In this recipe, you learned to deal with multipart requests at both server side and client side to transfer files. In this example, we posted a file to a server and returned the number of lines. On the client side, we used the Request-level API to trigger both the requests. The request entity is populated because of Multipart.FormData. This class is responsible for defining a multipart/form-data request and chunking your file into different parts.
On the server side, we had two different routes. The first route, namely regularupload, used the entity(as[Multipart.FormData]) directive to understand this is a multipart file that is being transferred. This yielded an instance of formData where the different parts of the files ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access