The server side

The server side is a WebBroker project with only two actions configured, as shown in the following table:

Action name

PathInfo

HTTP method

DefaultHandler

/

mtGet

waPhoto

/photo

mtPost

The waPhoto action receives the client's request, reads the data, and saves them on the file system. This action saves two files:

  • The actual image file as a .png image file
  • Another file containing all the location information in JSON format

Here's the code for the waPhoto action:

procedure TwmMain.wmMainwaPhotoAction(Sender: TObject; Request: TWebRequest;Response: TWebResponse; var Handled: Boolean);var  lFileStream: TFileStream;  lByteStream: TBytesStream;  lFileName: string;  lLat: Double;  lLon: Double; lInfoObject: ...

Get Delphi Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.