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 Apps / Add Picture Control - ...
Power Apps
Unanswered

Add Picture Control - Images taken from iPhone and sent to Outlook are corrupted/broken

(1) ShareShare
ReportReport
Posted on by 65
Hi all,
 
I have built an issue reporting app that utilises the Add Picture control, so whenever we have an issue in our office someone can open the app, report the issue and add a picture of the problem.
 
The issue I am facing at the moment is that whenever I go into the app on my iPhone 12, go to the Add Picture control, select Take a Picture and then hit the send button. I receive the email with the attachment but it is under 1kb in size and cannot be opened. It works fine if I attach an image from my desktop.
 
Any help would be appreciated as I am stuck.
 
Here is the code I am using
If(
    IsBlank(ambFileAttach.Media),
    Office365Outlook.SendEmailV2(
        "default.email@example.com",  // Default email address
        "New Issue logged via app",
        "<b>Name of Reporter:</b> " & TextInput_Name.Text & "<br>" & 
        "<b>Reporter Email:</b> " & TextInput_Email.Text & "<br><br>" & 
        "<b>Location of issue:</b> " & TextInput_Location.Text & "<br>" & 
        "<b>Subject of issue:</b> " & TextInput_Subject.Text & "<br><br>" & 
        "<b><u>Description of issue</u></b> " & RichTextInput_Description.HtmlText & 
        Navigate(Screen_Confirmation)
    ),
    Office365Outlook.SendEmailV2(
        "default.email@example.com",  // Default email address
        "New Issue logged via app",
        "<b>Name of Reporter:</b> " & TextInput_Name.Text & "<br>" & 
        "<b>Reporter Email:</b> " & TextInput_Email.Text & "<br><br>" & 
        "<b>Location of issue:</b> " & TextInput_Location.Text & "<br>" & 
        "<b>Subject of issue:</b> " & TextInput_Subject.Text & "<br><br>" & 
        "<b><u>Description of issue</u></b> " & RichTextInput_Description.HtmlText,
        {
            Attachments: Table(
                {
                    Name: ambFileAttach.FileName, // Use the original file name
                    ContentBytes: JSON(ambFileAttach.Media, JSONFormat.IncludeBinaryData), // Convert media to Base64 string
                    '@odata.type': If(
                        Right(ambFileAttach.FileName, 3) = "jpg" || Right(ambFileAttach.FileName, 3) = "jpeg",
                        "image/jpeg", // For JPEG files
                        If(Right(ambFileAttach.FileName, 3) = "png", "image/png", "application/octet-stream") // For PNG files or binary fallback
                    )
                }
            )
        }
    )
);
Set(varReportedLocation, TextInput_Location.Text)
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    68,707 Most Valuable Professional on at
    Check to see if the Content Bytes portion of the file that you are sending is enclosed in double quotes when sending as JSON. I saw this issue recently with uploaded files.  You have to remove the starting and ending double quotes or the image is corrupted.

    ----------------------------------------------------------------------------------
    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
     
  • KO-03031901-0 Profile Picture
    7 on at
    I seem to be having the same issue without using JSON. This feature has been used for over a year without any issues but just broke in the last few weeks. It seems to be confined to iPhones and works the same as before on other phones. 
     
    Here is a simplified version of the code I am using:
    With(
        {
            wFile: Table(
                {
                    Name: AddMediaButton1_2.FileName,
                    ContentBytes: AddMediaButton1_2.Media
                },
                {
                    Name: AddMediaButton1_3.FileName,
                    ContentBytes: AddMediaButton1_3.Media
                }
            )
        },
        Office365Outlook.SendEmailV2(
            "EMAIL",
            "SUBJECT LINE",
            "BODY",
            {
                Attachments: AddColumns(
                    wFile,
                    '@odata.type',
                    ""
                )
            }
        )
    )
     
    Any thoughts?
     

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard