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 / PowerApps File Upload ...
Power Apps
Unanswered

PowerApps File Upload Fails Over 20MB via Power Automate: Error 502

(0) ShareShare
ReportReport
Posted on by 15

Hi everyone,

I am working on a PowerApps Canvas App where users should upload attachments using the Attachment Control. The uploaded files are in the format of pdf or zip and I store them in a Share Point document library using a Power Automate flow. (File name and content are sent to Power Automate via a Power Apps trigger)

Issue:

  • I have set the MaxAttachmentsSize property to100MB,
  • However, the upload fails when trying to upload files larger than ~20 MB - In fact the flow is not triggered with large files and throw the error below: "error": {
    "code": 502,
    "source": "d89a820b-2095-...d101b318.04.common.usa002.azure-apihub.net",
    "clientRequestId": "5cf96e59-dd2...fcf-5e8342655d16",
    "message": "The response is not in a JSON format.",
    "innerError": "Cannot read server response."
    }
    }

Questions:

  1. Why does the upload fail at ~20MB even though Power Automate supports larger files?
  2. Is there a workaround to allow users to upload larger files?
I have the same question (0)
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at
    I assume you are sending the "raw" binary file using the Power Apps V2 connector - from some quick research, it appears Power Automate may not be able to consume that amount of binary data. Try converting it to JSON and then back again in the Flow.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • MehranDov Profile Picture
    15 on at
    Thanks @WarrenBelz for your time. 
    I tried multiple ways to implement your JSON conversion suggestion but I'm getting the resource reference issue. Here's one of the codes I used:
     
    Power Apps side:
    // 1. Convert the attachment to JSON string (with Base64)
    Set(
    varEncodedFile,
    JSON(
    First(DataCardValue3.Attachments).Value,
    JSONFormat.IncludeBinaryData
    ));

    JSON_Test_flow.Run(
    First(DataCardValue3.Attachments).Name,
    varEncodedFile);
     
    Power Automate side:
    I have a Compose control after Power apps (V2) trigger with the following expression:
    base64ToBinary(triggerBody()?['text_1'])
     
    However, Power Automate is receiving the content as "appres://blobmanager/ba73eed30c48412ead7d4419566c3586/1" instead of the actual binary data and fails. (ERROR: 
    InvalidTemplate
    Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0': 'The template language function 'base64ToBinary' was invoked with a parameter that is not valid. The value cannot be decoded from base64 representation.'.
     
    It seems PowerApps is sending the resource reference rather than the file content itself. Any thoughts on how to force PowerApps to load the actual binary data before sending it to the flow?
  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at
    Yes - you need to strip out the Header and also the leading and trailing quotes - so
    With(
       {
          _File: 
          With(
             {
                _JSON: 
                JSON(
                   First(DataCardValue3.Attachments).Value,
                   JSONFormat.IncludeBinaryData
                )
             },
             Mid(
                _JSON,
                Find(
                     ",",
                   _JSON
                ) + 1,
                Len(_JSON) - 
                Find(
                   ",",
                   _JSON
                ) - 1
             )
          )
       },
       JSON_Test_flow.Run(
          First(DataCardValue3.Attachments).Name,
          _File
       )
    )
    The code you have in the Flow should work on this.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • MehranDov Profile Picture
    15 on at
    Unfortunately, no. I tried editing the code you provided in various ways, but it didn’t work. The only workaround I’ve found so far is using Office365Groups, which I’m not comfortable with. For now, I’ve set the file size limit in the app to 25MB and am still looking for an optimal solution.

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