Uploading a file using Power Automate

Hallelujah! You pointed me on the right path, and after a lot more googling along that line, trial & error testing, I stumbled accross the answer :grinning_face_with_smiling_eyes:

The key things are:

  1. Format the request body as a multi-part form.
    • It’s confusing and complex, and I don’t fully understand (like why certain things like the fileName works in the header, but folderPath needs to be in the body) but hey - it works!
  2. The file content needs to be converted from Base64 (or whatever format you might have gotten it in) into Binary.

This is what the request looks like:

And this is the code for copy/paste:

(Bear in mind the file body is dynamic content so you’d replace that with your binary file data)

{
"$content-type": "multipart/form-data",
"$multipart": [
{
"headers": {
 "Content-Disposition": "form-data; name=\"options\""
 },
 "body": "{\"access\": \"PRIVATE\"}"
},
 {
 "headers": {
 "Content-Disposition": "form-data; name=\"file\"; fileName=\"Test.pdf\""
 },
 "body": @{base64ToBinary(outputs('Get_file_content')?['body']?['$content'])}
 },
 {
 "headers": {
 "Content-Disposition": "form-data; name=\"folderPath\""
 },
 "body": "/Uploaded Documents"
 }
 ]
}