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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Bytes sent from Power ...
Power Automate
Suggested Answer

Bytes sent from Power Apps obile application to populate image inside sharepoint will be invalid

(0) ShareShare
ReportReport
Posted on by 1,811 Super User 2024 Season 1
I have the following code, which capture the uploaded image inside a power apps canvas screen and call a power automate flow to populated the image:-
 
PopulateWorkOrderPictures.Run(
                "Spare Parts",
                varWorkOrder.'Work Order Type'.Value,
                TextInput1.Text,
                varWorkOrder.ID,
                Value(varProcessID),
                If(
                    IsBlank(varWorkOrder.Brand),
                    "None",
                    varWorkOrder.Brand
                ),
                If(
                    IsBlank(varWorkOrder.'Sequence Number'),
                    "None",
                    varWorkOrder.'Sequence Number'
                ),
                varnewWOSPD.ID,
                If(
                    IsBlank(varWorkOrder.'Network Name'),
                    "none",
                    varWorkOrder.'Network Name'
                ),
                {
                    file: {
                        contentBytes: UploadedImage_1_2.Image,
                        name: AddMediaButton_1_2.FileName
                    }
                }
            ).response
 
 
here is the workflow parameters:-
 
 
 
and the action to create the picture:-
 
 
 
 
now everything was working well for more then 2 years, on power apps web and power apps mobile application, but yesterday, i made some modifications to the power apps (not related to this process), and we have noted that any image uploaded from mobile apps either using "Take Photo" or "Photo Library" will be shown as corrupted inside SharePoint:-
 
 
 
and the file size will only be "56 bytes", unlike the images uploaded from power apps web browser, which will be 22 KB and more, as follow:-
 
 
 
Also the bytes send from power apps to power automate will be as follow incase of using mobile power apps:-
 
 
L1Nlc3Npb25TdG9yYWdlLzM3QjExRTU0LTI2Q0UtNDVFNi1BQTQ3LUU2N0I4MzU1MTYzOC5qcGc=
 
 
while the bytes will be much longer for a valid image.. any advice please on this? as it is happening on our prod app as well..
 
Thanks
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    68,707 Most Valuable Professional on at
    Why are you converting the ContentBytes sent from the Canvas App to Binary to create the file? The Create file action is expecting the ContentBytes in the same format as what you sent from the Canvas App.
     
    The other possible issue is if you are using an Attachment control to get the Image to be uploaded the image may point at a cache in the browser instead of the actual image.  When that happens you need to add the image file from the attachments control to an image control on the canvas to get the actual file.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • johnjohnPter Profile Picture
    1,811 Super User 2024 Season 1 on at
    @@Pstork1 but my code was working well, and it is still working on web browser.. so what i need to do? and I am using the picture control and not the attachment control since it allow the users to directly take photo from their mobile app,,
  • johnjohnPter Profile Picture
    1,811 Super User 2024 Season 1 on at
     
    also after some reading i modify the code inside the power apps to do this:-
     
    file: {
                            contentBytes: JSON(UploadedImage_1_2.Image,JSONFormat.IncludeBinaryData),
                            name: AddMediaButton_1_2.FileName
                        }
     
     
    where the file size will be 400 KB ,, but the file is corrupted,, also i am passing the filecontent as-is inside the create file,, this is working well on web browser, but failing on mobile app.. any advice?
     
     
  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at
    As I said in my reply, if you are using the upload control to get the file it often only includes a reference to a cached copy instead of the actual file.  My workaround is to add the file to an image control which forces the actual file to be used and then use that when running the flow.  This is particularly necessary if you are doing multiple files.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
     
     
     
  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at
    I suspect it works in the web browser and not in the mobile because of the size of the image.  In both the browser and the mobile app I've seen issues in the past when uploading image files that the actual image isn't there, just a reference to the cache.  Since mobile devices have less storage this is more common on mobile. I think that is what is happening in your case.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • johnjohnPter Profile Picture
    1,811 Super User 2024 Season 1 on at
    @@Pstork1 sorry i meant to say i am using image control and image button, as follow:-
     
     
     
    any further advice please?
     
  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at
    Does the image show properly in the image control on the mobile device when you add it?

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • johnjohnPter Profile Picture
    1,811 Super User 2024 Season 1 on at
     
    Yes it do as follow, here is an image uploaded from my mobile, showing well on the image control:-
     
     
    but was uploaded to sharepoint with only 56 bytes and the bytes passed to the flow will be only as follow:-
     
     
    L1Nlc3Npb25TdG9yYWdlL0U1QzdGNUVGLTZDRUYtNERCMi04NTk2LTc4NDk5NjdGOTM2NS5qcGc=
     
     
    and will be shown as corrupted inside the document library:-
     
     
     
     
     
  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at
    OK, I did a prototype of your solution and I think I know what the problem is.  I was using the Attachment control in my code while you were using the Add Picture control.  If you look at the JSON that comes out of the image control bundled with the Add Picture control you will see something like "appres://blobmanager/a07ad179a17e4255af08aa6cdd11db9b/3". Appres://blobmanager is a reference to the cache I was talking about.  You can't pass that and get the actual contents.  But if you add another image control to your app and load the image in the add picture control into it (the appres:// reference) you'll get the actual image.  Something like this: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAeAB4AAD/4TfiRXh...". That is the actual ContentBytes you need to pass.  Here's a screenshot of my sample. You can see JSON that comes out of the UploadedImage1.Image and the JSON that comes out of the Image1.Image.  You need the second one.
  • johnjohnPter Profile Picture
    1,811 Super User 2024 Season 1 on at
     
    Ok thanks for your help, so why this was working well since 2 years without issues? and now it start raising this error?
     
    also i am not sure how i can extract the needed charecters and send them to power automate? is there any formula i can use?

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 > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard