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: ...