When creating fully connected rich client applications, part of the expected standard functionalities, sometimes, is the ability to exchange files with the server. We have already seen how to download an image from the server (see recipe Downloading images with HttpRequest). In this recipe, we will look at how to use HttpRequest
to upload an image to the server.
The concepts presented here deals with HTTP and the HttpRequest
object in JavaFX. You should already have an understanding of the basic mechanics behind the Web and how HttpRequest
interacts with web servers to handle the request/response life cycle. Refer to the recipes Accessing remote data with HttpRequest, Downloading images with HttpRequest, and Posting data to remote servers with HttpRequest, in this chapter, for some background information on how to use the HttpRequest
object to interact with a web server.
For this recipe, we will assume that we have a web server running...