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 / file upload functional...
Power Apps
Unanswered

file upload functionality towards a sharepoint document library

(0) ShareShare
ReportReport
Posted on by 401

I’ve made an app to test file upload functionality towards a sharepoint document library, using a flow to create the file on sharepoint.

 

It went smooth and worked as expected, I tested two components to select the files, being an ‘attachments’ control, and a MediaButton control (it’s call ‘add picture’ in the GUI).  

 

 

attachment controlattachment controladd image controladd image control

 

Both buttons call the same flow called SendFileToFlow using the code below which stores the file on sharepoint.

 

 

Set(FilePath2, SendFiletoFlow.Run( 
 { file:
 { name: Last(Upload1.Attachments).Name
 , contentBytes:Last(Upload1.Attachments).Value 
 } } 
));

Set(FilePath1, SendFiletoFlow.Run( 
 {file: 
 { name:Upload.FileName
 , contentBytes:Upload.Media 
 }} 
));

 

 

flowflow

 

 

I had a nasty surprise when I tried the same code in the production app. It doesn’t work.

 

Now whenever I copy this working code into a new app, in conjunction with the very same flow, I get this exactly the same error message for each control:

 

new appnew app

So now I’m trying to understand why code is right in one app and wrong in the other.

 

I would assume since the contentBytes ‘type’ in the upload is set by the control it must be the same in every app!

 

How can I troubleshoot this further?

 

Thanks for any response.

 

While browsing the forums I found someone suggesting to add an odata type to the statement.

pic5.png

 

It doesn't seem to help, but maybe I did not get it correctly.

 

Michel

 

 

In both the working and the failing case the control.Attachments.Name and the control.Attachments.Value of the attachments return this:

 

secretstuff.pdf 
appres://blobmanager/1c18e61fbcf34bc4a9dd9bfed5706806/1

 

 

Categories:
  • ohthreesixfive Profile Picture
    25 on at

    Hi @MichelH,

     

    I'm intrigued by your implementation to get this functionality, and will have to play around with it later!

     

    In the meantime, if you'd like you're welcome to use the attachments component + flow I posted recently:

     

    https://twitter.com/ohthreesixfive/status/1196945403121324033

     

    Feel free to let me know if you run into any issues using it.

     

    Cheers!

     

    Ramiro

     

  • MichelH Profile Picture
    401 on at

    Thank you @ohthreesixfive  Ramiro,

     

    The flow part is based on what I learned on John Liu's site, so all credits for that go to him and the attachments control taken out of the form and used as a generic upload component is what I saw in a recent video from Shane Young, he was uploading to azure, but the idea is the same, so all credits for that go to him.

     

    Great idea to put this upload stuff in a component to (hopefully) assure portability between apps.

    I will have a look.

     

    Michel

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard