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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Answered

Uploading button

(0) ShareShare
ReportReport
Posted on by

Edit -- i think I just figured this out and I can't delete this post.  I just inserted a new 'attachment' field...but I read a post somewhere indicating PowerApps does not support more than one attachment fields so unsure if this is the right way to do it. I'll continue testing. 

2019-06-12_1104.png

------

Is it possible to add a button in PowerApps that would upload files to SP Document library? Not attachments. I basically need two attachment controls -- one control would be to attach all supporting documents while the other to upload docs requiring review and approval.  I want the latter to be stored in a document library while the supporting docs can remain as attachments on a list item. Search results mentioned about uploading the attachments to a document library using Flow but I don't need all attachments to be uploading -- so I'm hoping its possible by adding an 'upload' button. Basically, when user clicks the upload button, user selects the document and it will be uploaded in library.  I just need to figure out what type of control I could use for user to select the document from local drive. 

 

 

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,725 Most Valuable Professional on at

    Flow is still your best bet.  You can kick off the flow using a PowerApps button and pass the document data to flow as a parameter.  Flow can then easily save the document to a SharePoint document library.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Tamras 

    Yes, you can definitely use the Attachment control to gather local files.  

    In your case, I would consider pulling the second list (the supporting documents) out of your EditForm.  Yes, you can actually select the Attachment control in the Form and cut and paste it outside of the Form.  Then you have a little more flexibility on getting local files into that control.  

    However, from there, Flow is the way to go.  

    Create a Flow that accepts a FileName and the ContentBytes.  In the Flow use the Create File action to specify your Document Library, the folder, the File Name (as passed from PowerApps) and the File Content (as passed from PowerApps).  

    You could adapt that to do multiple files as well if needed.

     

    I hope that is helpful for you.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Tamras 

    Actually, just looked at a couple things here.  Not sure if this is completely accurate at this point as I need to investigate more...

    The main reason that I used to pull the Attachment control out of a Form was twofold:

    1) The Attachment control used to be on the Insert Controls list...it was removed some time ago.

    2) I liked that control because it would open a File Dialog with "*.* All Files" as the file type.  Using an Add Picture control was an option, but it always opened the File Dialog with "Picture" as the file type...very annoying if you are dealing with a bunch of Doc or PDF files.

     

    So, if I pulled the Attachment control out of the form and stood it on its own, it would give me the support to get the File Dialog that I wanted.

     

    To cut to the chase - I just looked at a sample App that I put together that used this perfectly.  In that app I had also put the Add Picture control for contrast in testing.  I just clicked on it and it brought up a Dialog with "*.* All Files".  What???  Went into another app and threw an Add Pictures Control and same thing!!

    So, either there is a new bug with the Add Picture control, or they changed it to allow all files to be the default.  But, technically at this point...I would ditch the attachment control all together in favor of the Add Picture control.

     

    Just thought I might add that to your thoughts. 

  • Aethyta Profile Picture
    on at

    @RandyHayes The Add Picture control only allows 1 picture or file?  I need something that would allow users to add multiple files.  But I like the idea for another app I need to create after this one.  Thanks. 

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Tamras 

    Well, I should have expanded on my explanation a bit...

    I use the Attachment control to build a collection of files.  Again, primarily using the control only because of the "*.* All Files" dialog.  

    So, now, if this holds true that it will stay that way, I can discard the attachment control and use the add picture control - this, like the attachment control, simply dumps info into a collection which is the real place where I deal with multiple files.

     

    Hmmm, I think I might have explained that properly!?

  • v-yuxima-msft Profile Picture
    on at

    Hi @Tamras 

     

    Do you solve your issue with @RandyHayes 's and @Pstork1 's suggestion? if yes, please accept it as solution.

     

    Best Regards.

    Yumia

     

     

  • Aethyta Profile Picture
    on at

    @v-yuxima-msft I will once I get it working.  I'm still trying to get add picture to work as for selecting the file to download then I will add Flow.

    @RandyHayes  I am not getting this right. I did an add picture media in PowerApps. But after I selected the file to be uploaded, the display changed to "Change Picture" -- is there a way to change it to the picture's URL?  Or did you mean to add a column in SP List with "hyperlink/picture" type?  I'm trying this now...

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Tamras 

    Yes, you can change the text of the Add Picture control by chaning its ChangePictureText property.

    When you say the URL, are you meaning the URL from where you got it, or the internal URL?  Useful properties of the control are FileName and Media.  If you use the Media property in text somewhere, that will display the internal resource URL.

    I hope that is what you were looking for.

  • Aethyta Profile Picture
    on at

    @RandyHayes  Thank you. I really like the Add Picture control to select a file once I learned more about it. Although, it defaults to Image Files I just added a hint for users to change it to All Files. Now I just need to set up my flow and trigger it using an Upload button I added in PowerApps.  


    2019-06-14_1549.png

  • Aethyta Profile Picture
    on at

    @Pstork1 I'm not sure what I'm doing wrong. I added a flow and it saved a file in the library but when I open the file, it says "Failed to load PDF document"

    Below is my formula on Upload button OnSelect. I don't know how I could actually get the FileContents right.

    UploadToLib.Run("", AddMediaButton3.FileName, AddMediaButton3)

    Also tried "" and AddMediaButton3.Media as FileContents.

     

    UploadToLib.Run("", AddMediaButton3.FileName, "")

     

     

    Flow

    2019-06-14_1630.png

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard