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.
Solved! Go to Solution.
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.
I hope this helps! 🙂
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.
I hope this helps! 🙂
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