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

multipart/form-data

(4) ShareShare
ReportReport
Posted on by 1,088
I have a webhook from an external app.  That is sending files that are submitted.
 
I have a flow
 
I have a trigger in the flow "When an HTTP Request is received"
 
The webhoook sends as "multipart/form-data" type
 
So cant generate a schema, just leave blank.
 
Can't parse json, since not json
 
I can try to do splits, replaces, etc.
But it is very messy and it seems like when you convert to string for the replaces, it changes the base64 content to something else? XML?
 
What is the best way to do this?  Below is an example of what the webhook sends.. the content has been removed from the word document, there will always be 1 resume, 1 aadhar card, 1 pan card but could be multiple pay documents...:
 
{
  "$content-type": "multipart/form-data; boundary=1924ec1e13c",
  "$content": "<CONTENT BASE64>",
  "$multipart": [
    {
      "headers": {
        "Content-Disposition": "form-data; name=\"pancard\"; filename=\"resume.docx\"",
        "Content-Type": "application/x-tika-ooxml",
        "Content-Length": "14777"
      },
      "body": {
        "$content-type": "application/x-tika-ooxml",
        "$content": "<CONTENT BASE64>"
      }
    },
    {
      "headers": {
        "Content-Disposition": "form-data; name=\"aadhardcard\"; filename=\"aadhar.txt\"",
        "Content-Type": "text/plain",
        "Content-Length": "6"
      },
      "body": "aadhar"
    },
    {
      "headers": {
        "Content-Disposition": "form-data; name=\"payslips\"; filename=\"pay2.txt\"",
        "Content-Type": "text/plain",
        "Content-Length": "3"
      },
      "body": "pay"
    },
    {
      "headers": {
        "Content-Disposition": "form-data; name=\"payslips\"; filename=\"pay.txt\"",
        "Content-Type": "text/plain",
        "Content-Length": "3"
      },
      "body": "pay"
    }
  ]
}
 
 
Categories:
I have the same question (0)
  • Suggested answer
    MichaelFP Profile Picture
    1,999 Moderator on at
    using the replace to remove "$" and after parse to JSON it will work. Because properties with "$" are internally handle by Power automate. 
     
    you can replace "$" from: $content-type, $multpart,$content, to avoid to remove from a text that has the symbol.
     
    after that you be able to interact with the content.
     
    If my answer helped you, please give me a thumbs up (👍). If solve your question please mark as answer ✔️. This is help the community.
  • Mattw112b Profile Picture
    1,088 on at
    So the weird part is, the output of the body of the "When HTTP request is received" trigger, doesn't look anything like the input to the compose directly after it?
     
    So the "$" items above for example arent there.. it looks like this:
     
     
    so can't really remove the "$" and there's no way really to convert this to json.
     
    so then it gets messy trying to split, replace, etc.  on this.  When I try I have to convert to string, then have all these \r\n\r\n characters.. then the base64 gets converted to somethign else ?xml?  
     
     
  • Verified answer
    MichaelFP Profile Picture
    1,999 Moderator on at
    Apply the steps below to get each file from multi-part format.
     
    First you need to get muiltpart content. for that you need to use the compose using the following expression
     
    triggerBody()?['$multpart']
     
     
    it will give to you the array of the files, so you will now using apply for each with the result of the compose
     
     
     
    Now you will be able to loop over the files send. So now we will get the binary and the file name
     
    Get the file
     
    Inside the "Apply to each" use the compose action with the following expression:
     
    item()?['body']
     
     
    Get File Name
     
    Inside the "Apply to each" use the compose action with the following expression:
     
    replace(split(split(item()?['headers/Content-Disposition'], 'filename="')[1], '"')[0], '\"', '')
     
     
    and now you can try to receive a new file.
     
    in your flow you will see that you got the file binary and file name
     
     
    Hope that helps you!
     
     
    If my answer helped you, please give me a thumbs up (👍). If solve your question please mark as answer ✔️. This is help the community.
     
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 801

#2
Valantis Profile Picture

Valantis 602

#3
Haque Profile Picture

Haque 581

Last 30 days Overall leaderboard