Upload An Image With The BaaS Components For Delphi XE6 Firemonkey On Android And IOS

Delphi XE6 Firemonkey BaaS Image UploaderSarina DuPont from Embarcadero has a blog post up with a tutorial for uploading and viewing images using the BaaS components in Delphi XE6 Firemonkey. Parse is the backend provider used in the tutorial. The main component is the TBackendFiles component which plugs into the provider component (in this case TParseProvider). You basically save your image to a TMemoryStream and pass that to the UploadFile function of TBackendFiles.Files. What is also interesting about this tutorial is that it shows how to use the response object which is a TBackendEntityValue to get the URL of the uploaded file. Here is the example upload code:

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:

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.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Upload An Image With The BaaS Components For Delphi XE6 Firemonkey On Android And IOS by Delphi XE5 XE6 XE7 XE8 10 Seattle Berlin Firemonkey, Delphi Android, Delphi IOS is licensed under a Creative Commons Attribution 4.0 International License.

4 Responses to Upload An Image With The BaaS Components For Delphi XE6 Firemonkey On Android And IOS

  1. Dave Gill says:

    This is useful but is there a way I can do something similar without the cloud stuff? I.e. Just upload the image to my own web server

    • Admin says:

      PHP or ASP.NET?

    • Admin says:

      uses REST.Types;

      var
      jpg : TMemoryStream;
      begin
      if OpenDialog1.Execute then
      begin
      RESTClient.BaseURL := ‘https://api.parse.com’; // change to base url rest api
      RESTRequestPost.Resource := ‘/1/files/pic.jpg’; // change to rest api resource
      jpg := TMemoryStream.Create;
      jpg.LoadFromFile(OpenDialog1.FileName);
      RESTRequestPost.AddBody(jpg,TRESTContentType.ctIMAGE_JPEG);
      RESTRequestPost.Execute;
      end;
      end;

      http://php.net/manual/en/function.http-get-request-body.php

      • Jose Morango says:

        Can’t make this sample work, do i need to have a parse.com account?

        what does it mean to change to url rest api, it is my server
        and the rest api resource?
        RESTClient.BaseURL := ‘https://api.parse.com’; // change to base url rest api
        RESTRequestPost.Resource := ‘/1/files/pic.jpg’; // change to rest api resource

        Regards

        Jose

Leave a Reply

Show Buttons
Hide Buttons
Read previous post:
Instant Messaging Demo Client And XMPP Component For Delphi XE6 Firemonkey On Android And IOS

Instant messaging apps like Whatsapp, Kik Messenger, and Snapchat are hot right now and there are some existing instant messaging...

Close