cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dmwolny
Frequent Visitor

Get File Name from AI Form Processor

Hi,

 

 I have a canvass app that uses a form processor to extract data from a form. The form processor can accept images or pdf files, and after it is analyzed a SharePoint list item is created with the data. I want to upload the file used in the form processor as well.

 

I have created a power automate flow that is able to upload the file as an pdf attachment to the SharePoint list. However, it is hardcoded to save it as a pdf file. I need to be able to save the file as the original file type.

Dmwolny_0-1668880406045.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
JoeF-MSFT
Power Apps
Power Apps

Hi @Dmwolny

 

Getting the file name is unfortunately not possible. Maybe you can use some of the extracted fields from the document by the AI model to use that as the file name?

 

To get the type, you can do the following condition to the file content that is being sent from the Power App (the same input you're using in the dataUriToBinary function). If it contains application/pdf then the file should be saved as a PDF. If it contains image/jpeg or image/png then it should be saved as an image. 

 

JoeFMSFT_0-1668963268073.png

 

I hope this helps! 🙂

View solution in original post

2 REPLIES 2
JoeF-MSFT
Power Apps
Power Apps

Hi @Dmwolny

 

Getting the file name is unfortunately not possible. Maybe you can use some of the extracted fields from the document by the AI model to use that as the file name?

 

To get the type, you can do the following condition to the file content that is being sent from the Power App (the same input you're using in the dataUriToBinary function). If it contains application/pdf then the file should be saved as a PDF. If it contains image/jpeg or image/png then it should be saved as an image. 

 

JoeFMSFT_0-1668963268073.png

 

I hope this helps! 🙂

Dmwolny
Frequent Visitor

Thanks Joe! Your solution worked like a charm.

 

The file name isn't as important as the extension. Instead of using compose I initialized a string variable and set the extension in the variable in the condition. Then I jus called the variable in the file name field for the extension.

 

Thanks again

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,743)