web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Power Up Program Community
Suggested Answer

Error Uploading image from Powerapps Gallery using Add Attachment action in flow

(1) ShareShare
ReportReport
Posted on by 2
I have a gallery in which there is AddMedia control and on change of AddMedia control using the below logic 
 
ClearCollect(
    colImages,
    {
        ItemID: Gallery.Selected.ID,  // Link each image to an item ID in SharePoint
        ImageFile: UploadedImage1.Image  // Capture the image file from the gallery control
    }
);
 
Then passing the Image to flow as below on powerapps button click as below:
 
  Animal_UploadImage.Run(
       Last(AnimalFightChild).ID,
        ThisRecord.UploadedImage1.Image , FileName
    )
);
 
Then creating as flow but it is erroring when using Add Attachment control even trying as
 base64ToBinary(triggerBody()['Base64ImageContent'])
 
datauritoBinary(triggerBody()['Base64ImageContent'])
 
Categories:
I have the same question (0)
  • Suggested answer
    Inogic Profile Picture
    1,277 Moderator on at
    Hi,
     
    I faced the same issue while passing image from PowerApps to Power Automate. The problem is that PowerApps sends the image as a data URI with quotes, and because of that dataUriToBinary() fails in the flow.



    Here’s what worked for me:
    In PowerApps, I used an Image control as an intermediate step (this is important), and then converted it using JSON:


    Set(
        imgData,
        JSON(Image1.Image, JSONFormat.IncludeBinaryData)
    );

    'PowerAppV2->Compose'.Run(
        "TestImage.jpg",
        imgData
    );

    Notify("Uploaded Successfully ", NotificationType.Success);


    In Power Automate, I added a Compose action and used this expression:
    dataUriToBinary(replace(triggerBody()['FileContent'], '"', ''))

    The key part is removing the quotes using replace(), otherwise the conversion fails.



    After that, You can used the Compose output in Create File / Attachment and it will work perfectly.

    Hope This helps!
     
    Thanks!
    Inogic

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Microsoft Power Up Program Community

#1
Sunil Kumar Pashikanti Profile Picture

Sunil Kumar Pashikanti 24 Moderator

#2
MH-03032028-0 Profile Picture

MH-03032028-0 18 Microsoft Employee

#3
CU06040619-0 Profile Picture

CU06040619-0 11 Microsoft Employee

Last 30 days Overall leaderboard

Featured topics

Introduce yourself!