ATTENTION
15.7.2025 Microsoft changed platform and no need to change the file to string bytes anymore – Agent Flow can have parameter type File from now on!
I want to upload document in the Copilot Studio Agent chatbot interface and handle it with Agent Flow which saves it into Dataverse table row column type of file. Once I have already half way implementing this, I was thinking that it would be easier to be done with Power Automate as instructed.
I found this article https://digitalmill.net/2025/05/20/send-files-attached-by-the-user-from-microsoft-copilot-studio-to-power-automate/ and started to implement it not with Power Automate but with Agent Flow. I was thinking that I should be doing this totally with Copilot Studio interface and not going to the traditional maker portal.
I need every time to run it from the chatbot interface
With Agent Flow I could not rerun the flow run, since the user running the flow is different and I cannot set run-only user like in Power Automate. After first try-out I face below error.

Error Message: The flow 'Add files from applicant to Dataverse' ('e6abc016-0450-f011-877b-7ced8d40e1b6') failed to run with response code 'BadRequest', error code: TriggerInputSchemaMismatch. Error Code: FlowActionBadRequest Conversation Id: 0f0ea9ad-e7a1-4cdf-a648-1b5472f77bd0 Time (UTC): 2025-06-24T10:21:42.044Z
I have different type of JSON in my solution than in the instructions, so I don’t need the filter array action which is failing into error.

I need to change the each statement to below code
outputs('Compose_CV_-_JSON')?['OriginalAttachments']

After couple times of trying I noticed I don’t need the HTTP action either. So here are the expressions you need to put into the Upload CV (Upload image or File) action to get the file into Dataverse table row file column.
item()['name']
base64ToBinary(replace(item()['contentUrl'], 'data:application/pdf;base64,',''))

And finally I got the file into the Dataverse table row

Now I can see the job application in my model-driven app below

UPDATE 5.8.2025
Put the file as type file

Remove the condition, add file name and content with below code. File parameter offers out-of-the-box contentBytes but the content is actually in the content, so this needs to be added manually and use base 64 to binary function.
base64ToBinary(triggerBody()?['file']?['content'])

And send it with code
First(System.Activity.Attachments)

Next I post about reading the file from Dataverse.