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

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Adding File Upload option to Microsoft Form via Flow HTTP Request and javascript

(0) ShareShare
ReportReport
Posted on by 183

Hi,

I've been struggling with a client requirement where they need external customers to be able to upload an image of an insurance card on a Marketing Form. I understand that the marketing forms do not currently have this option and I'm trying to avoid Portals, mainly because I've already built the form for them within Marketing and I don't want to have to build out the entity forms and so on. I've read that there are ways to extend marketing forms and so I'm trying to implement an option where I would have a file repository in Flow using "When a HTTP request is received" and then somehow send to that from the form. However, I'm struggling with how to extend the Marketing form to send to that endpoint as well as have the "file upload" option display on the form. Is there a way to do this or am I stuck with having to rebuild within Portals?

I have the same question (0)
  • Suggested answer
    Nya Profile Picture
    29,060 on at
    RE: Adding File Upload option to Microsoft Form via Flow HTTP Request and javascript

    Hi,

    Please refer to the following article to build a files processing service endpoint with Flow.

    Accept HTTP Requests in a Flow and send Response back | Power Automate | D365 Demystified

     

    And then read uploaded files via FileReader.readAsDataURL() method in the page which contains your marketing form to extract file's data in base64 encoded string format and send data to the endpoint.

    FileReader.readAsDataURL() - Web APIs | MDN (mozilla.org)

     

    If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.

    Best Regards,

    Nya

  • pdr469 Profile Picture
    183 on at
    RE: Adding File Upload option to Microsoft Form via Flow HTTP Request and javascript

    Yes I've seen those articles and the first one did help me setup the HTTP Request flow but I can't figure out how to get the FileReader.readAsDataURL() to work within the javascript on the form's page. I tried using the article as a guide but it doesn't do anything when I submit. Do you have an example of this working that you can point me to? I haven't been able to find someone who actually did this.

  • pdr469 Profile Picture
    183 on at
    RE: Adding File Upload option to Microsoft Form via Flow HTTP Request and javascript

    I found some code that got me really close. It lets me post to the HTTP Request from the Marketing Form like I want but I can't seem to get it to send the actual file that was uploaded when I was in the form. I've been searching for an example of how to do that piece but I can't seem to find anything that really matches what I need. Here's what I've got so far that does at least go out to the endpoint. What I'm missing is code that will tell it how to pull the file I upload and then send that data out to Flow:

    <input type="file" accept="image/*" onchange="openFile(event)"><br>

    <img id="output">

    <script>

     var openFile = function(event) {

       var input = event.target;

       var reader = new FileReader();

       reader.onload = function(){

         var dataURL = reader.result;

         var output = document.getElementById('output');

         output.src = dataURL;

       };

       reader.readAsDataURL(input.files[0]);

     };

    const xhr = new XMLHttpRequest()

     xhr.open('POST', '<myflowHTTPRequestURL>')

     xhr.send('output')

    </script>

  • pdr469 Profile Picture
    183 on at
    RE: Adding File Upload option to Microsoft Form via Flow HTTP Request and javascript

    I figured out a way to get it to post the uploaded file to my Flow HTTP Request which is great but now I'm trying to understand how to connect it back to the submitter. Right now it just posts the file out to the repository and then my idea was to have Flow post it to Dynamics but I need the submitter information included. How can I do that?

  • Suggested answer
    pdr469 Profile Picture
    183 on at
    RE: Adding File Upload option to Microsoft Form via Flow HTTP Request and javascript

    After countless hours of googling and trial and error, I finally found a solution. I'm just posting this for anyone who is trying something similar and isn't finding any detailed help. It's certainly not an elegant solution since I'm fairly new to development but it does work. The solution is to create a small form on the Marketing page where the Marketing form exists. This form will include the file upload, the email field, and the URL from the "When an HTTP Request is Received" flow. The email value serves as the key you can use in the Flow to search Dynamics for the person who uploaded the file and then you can include the uploaded file as a Notes attachment. There might be an easier solution someone knows where you can somehow include this in the Marketing form submission itself and POST the details to Flow but I wasn't able to do it.

  • Nya Profile Picture
    29,060 on at
    RE: Adding File Upload option to Microsoft Form via Flow HTTP Request and javascript

    Hi,

    Thank you for your sharing. It broadened my thoughts.

     

    Best Regards,

    Nya

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 235

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 177

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 156 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans