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 Platform Community / Forums / Copilot Studio / Unable to upload the f...
Copilot Studio
Suggested Answer

Unable to upload the file along with the HTTP request to my API in copilot studio

(0) ShareShare
ReportReport
Posted on by 5
Hi,
 
I'm trying to upload a file that the chat bot will ask and store it in a variable, and I wanted to upload the same with a simple HTTP request to my API, but apparently I could not find 
any option that would allow me to attach as such. Here's the flow I've build:

 
I have tried and tested setting all parameters, but no luck.
 
Any help is appreciated.
 
Thanks in advance!
  • Suggested answer
    Artur Stepniak Profile Picture
    1,539 Moderator on at
    Hello,
     
    first of all, you're using `file` variable in the Content Type section - it's not correct. You also don't need to define Content-Type header separately as the Content Type field is for that purpose. You should use JSON in the body. Here's an example which you could use, it's from Power Automate, so you'd need to alter it a bit:
     
    {
      "$content-type": "multipart/form-data",
      "$multipart": [
        {
          "headers": {
            "Content-Disposition": "form-data; name=\"file\"; filename=\"@{utcNow('yyyyMMddHHmmss')}.pdf\""
          },
          "body": "@{body('Get_file_content')}"
        }
      ]
    }
     
    In case of any other questions, let me know. If the answer helped you, mark it, so that others can benefit from it.
     
    Best regards,
     
    Artur Stepniak
    Interested in GenAI? Visit my site!
  • AD-23121232-0 Profile Picture
    5 on at
    @Artur Stepniak Thanks for your reply! I have spent so many hours trying to figure out, even tried the snippet you gave, but I feel like it's not processing the variable as an object, instead as a string. Maybe because you shared the syntax for Power Automate? Is it possible there's some other syntax for it, or even it may not support this? 
     
    I just need to upload the file received to my API. Hope I find some solution!
     
    Thanks for the support, appreciate it.
     
    Best regards,
    Aum Dabke
     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Copilot Studio

#1
11manish Profile Picture

11manish 113 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 79

#3
anirudhev Profile Picture

anirudhev 72

Last 30 days Overall leaderboard