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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Uploading files to doc...
Power Apps
Answered

Uploading files to document library from Power Apps via Power Automate not working

(0) ShareShare
ReportReport
Posted on by 16

Hi,

 

I created a canvas power apps that lets the user upload documents to their folders in a SharePoint Document Library. These folders were created via Power Automate. I followed Matthew Devaney's approach to get the file from Power Apps then Power Automate creates/uploads the file to their assigned folders.

 

All was working well a few weeks ago but yesterday, we have been getting errors. Upon my investigation, the file object/data is not being carried over to Power Automate.

 

This is my Upload button formula:

Uploadattachment.Run(
 3, //MasterFileID
 "Employee Photo", //DocType
 "MyFolderName", //FolderName
 {
 contentBytes: First(attFile.Attachments).Value,
 name: First(attFile.Attachments).Name
 }
)

 

File Name:
Filename.PNG

 

 

ContentBytes Value:
Blob.PNG

 

 

Then this is my Power Automate Trigger:

PowerAutomateTrigger.PNG

 

 

 

 

 

 

 

 

 

 

 

Then this is the error I get:

PowerAutomateError.PNG

 

Things I've tried:

  • Uploading file directly in the document library folder
  • Checked my permission and the service account's permission
  • Checked the file data from Power Apps and it is not empty, I can see the name and contentBytes value

 

Has anybody else encountered this error? I tried redoing the same approach on a new app and flow but it is still the same.

 

I'm not sure if this is the right place to ask or in the Power Automate community, please let me know if I need to move the question.

 

Thank you!

Categories:
I have the same question (0)
  • victorcp Profile Picture
    2,350 Moderator on at

    Hi,

    The content bytes cannot be a blob link, so in order to get the content bytes of the file you can create a image control and set the image as:

    First(attFile.Attachments).Value

     and then set the content bytes as the image from the image control like this:

    Uploadattachment.Run(
     3, //MasterFileID
     "Employee Photo", //DocType
     "MyFolderName", //FolderName
     {
     contentBytes: ImageControl.Image,
     name: First(attFile.Attachments).Name
     }
    )

     

    Here is a demo:

    victorcp_0-1684402096541.png

     

    victorcp_1-1684402121226.png

    I set the image background to yellow to make it easier to see, but you can set the visible to false to hide it.

     

    I hope it helps 🙂

  • marumaru Profile Picture
    16 on at

    Hi,

     

    I tried your approach but it is still giving me the same error in power automate. The file content in Power Automate is still empty.

  • Verified answer
    victorcp Profile Picture
    2,350 Moderator on at

    There is another thing that you should do, you have to make it required (I don't know why it is needed but it only works this way)

     

    victorcp_2-1684405496758.png

     

    Let me know if it works

     

     

  • marumaru Profile Picture
    16 on at

    Hi,

     

    This worked! It's kind of funny that everything broke just because I did not make this required 😅.

    Thank you very much 😊

  • hemalathamodini Profile Picture
    4 on at

    For me this option not showing....what should i do?....actually i have another field also i.e, Person 

    how can write the powerapps code for that? i have five fields 1.File content,2.File name,3.MainlistID,4.Person,5.DocTypName......tell me the PowerApp formula for this

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,074

#2
Valantis Profile Picture

Valantis 639

#3
11manish Profile Picture

11manish 606

Last 30 days Overall leaderboard