Video blog: Convert Uploaded File into Base64 and View it as well

To convert an uploaded file into Base64 without staging the data in any cloud storage.

High level resolution steps

  • I have made use of Power Automate to Convert Base64 along with Data URI.

Detailed resolution steps

Step 1: Develop a Power Automate flow and add it into the solution and add it into the app as well:

Step 2: Add an attachment control using “Edit Form” as there is no direct functionality >> add a text
label to show the Base64 >> and add a PDF viewer control.

Step 3: Add the below formula on “OnAddFile” of Attachment control


Set
(
  fileBase64,
  'PowerAppV2->Compose2,RespondtoaPowerApporflow'.Run
  (
    {
      file:
      {
         contentBytes: First(DataCardValue18.Attachments).Value,
         name: First(DataCardValue18.Attachments).Name
      }
    }
  ).base64
)
    

Step 4: Give the variable into Text Property of the label and the document property of the PDF viewer.

Output

Once we add a file, the flow runs and gives you the Base64 with DataURI and you can see the PDF in the viewer control