var
LStream: TStream;
LFile: TBackendEntityValue;
begin
LStream := SaveImage;
try
BackEndFiles1.Files.UploadFile(’mypicture3.png’,LStream, ‘image/png’,LFile);
ShowMessage(’Image has been uploaded’);
Edit1.Text := LFile.DownloadURL;
The download image function is also interesting and it downloads to a TMemoryStream as well before loading it into a bitmap. The download code snippet is here:
var
LStream: TMemoryStream;
begin
LStream := TMemoryStream.Create;
try
REST.Client.TDownloadURL.DownloadRawBytes(AUrl, LStream);
Image2.Bitmap.LoadFromStream(LStream);
finally
LStream.Free;
end;
Head over and check out the full tutorial on how to upload an image using the BaaS components and then download and view the same image.
Upload An Image With The BaaS Components For Delphi XE6 Firemonkey On Android And IOS
