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 Platform Community / Forums / Power Apps / Upload files from Powe...
Power Apps
Unanswered

Upload files from Powerapps to Sharepoint

(0) ShareShare
ReportReport
Posted on by 443

Hello,

 

i have a form in my Power app. I don't want to use the attachments field in the edit mode. Instead i ve inserted an 'add picture control'.

I want the users to be able to upload files (not images) and save them to a SP doc library (ms flow).

In the doc library i  want the actual file name and not the 'appres://blobmanager/18f52060d737479cad911665f4e49362/2' for example.

How is that possible?

 

 

 

 

 

 

 

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @marial16 
    Rather than explain it on the forums its best just to watch the @Shanescows video on this

    Link to video:

    https://www.youtube.com/watch?v=3QaiM8SeWfM

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • marial16 Profile Picture
    443 on at

    I ve already seen that video. I don't know if it will work in my case since i will have to work IN my form and reuse the attachment control in at least 3 fields (instead of a link field)

  • mdevaney Profile Picture
    29,989 Moderator on at

    @marial16 
    Sorry, that's all I can suggest.

  • v-xida-msft Profile Picture
    on at

    Hi @marial16 ,

    Do you want to upload a file (not image) via the "Add Picture" control, and then save back to your SP Library?

     

    Based on the needs that you mentioned, I think the combination of Power Apps and Power Automate could achieve your needs. I have made a test on my side, please take a try with the following workaround:

    Flow's configuration:

    2.JPG

     

    App's configuration as below:

    3.JPG

     

    4.JPG

    Set the OnSelect property of the "Pass" button to following:

    'Your Flow Name'.Run(AddMediaButton1.FileName, Substitute(JSON(UploadedImage1.Image, JSONFormat.IncludeBinaryData),"""", ""))

     

    When you upload file from your local through the "Add Picture" control, please select file type to "All Files":

    5.JPG

     

    Please check and see if the following video resource would help in your scenario:

    https://www.youtube.com/watch?v=UYK7yruBHDM

    https://www.youtube.com/watch?v=kQVYid1p_vA

     

    More details about firing a flow from a canvas app, please check the following video resource;
    https://www.youtube.com/watch?v=1wl9AtxWdkg

     

    Best regards,

  • marial16 Profile Picture
    443 on at

    Correct.

    I used a very similar approach.

    heeeeeeeeeeeeeeelp.png

    plzzzzzzzzzzzzzzzzzzzzz.png

    Is there a way expanding the flow to retrieve the url of each file and return it back to powerapps?

     

  • marial16 Profile Picture
    443 on at

    Testing your solution gets me an error.

     

    noooooooooooooo.png

     

    Testing my solution inside the form's dataCard seems to not upload the file. 

    Yeeeeeeeeeeeeeeeeeeeeeeeees.png

     

  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @marial16 ,

    Have you taken a try with the app's configuration I provided above?

     

    Based on the error message screenshot that you mentioned, I think there is something with the File content passed from your canvas app to your flow.

     

    I guess you passed the File Content to your flow using the following formula directly, right?

    UploadedImage1.Image
    

    the above formula would return blob data as below:

    appres://blobmanager/4d007470709b4ec98e84e28de1ba58e4/1

    which is not an binary data, it is just a reference to the memory in your device.

     

    Within your flow, if you want to create a file in your SP Library, you must provide a binary data for this file. So within your canvas app, you must convert above blob data (e.g. appres://blobmanager/......) into a binary data firstly.

    You could use the JSON function to convert your blob data into a base64 encoded data, then pass the converted base64 encoded data back to your flow.

    'Your Flow Name'.Run(
     AddMediaButton1.FileName, // Retrieve Uploaded File Name
     Substitute(JSON(UploadedImage1.Image, JSONFormat.IncludeBinaryData),"""", "") // Get the binary data of the uploaded file
    )

    Please consider take a try with the app's configuration I provided above, then try it again, check if the issue is solved.

     

    Of course, if you want to save the uploaded files into a collection, then pass the whole collection data back to your flow, you should also store binary data for the uploaded file in your collection rather than Blob data.

    Please set the OnChange property of the AddMediaButton1 to following:

    Collect(
     FilesCollection,
     {
     FileName: AddMediaButton1.FileName,
     FileContent: Substitute(JSON(UploadedImage1.Image, JSONFormat.IncludeBinaryData),"""", "")
     }
    )

    after you attach a file through the "Add Picture" control, the file name and corresponding base64 encoded file content would be stored into this collection:

    1.JPG

     

    Then when you want to pass the whole collection to your flow, you need execute the following formula:

    'FlowName'.Run(JSON(FilesCollection, JSONFormat.IncludeBinaryData))

    After that, within your flow, you could use the dataUriToBinary() function to convert the passed base64 encoded data into a actual binary data. Based on the converted binary data, you could create file in your SP Library.

     

    Best regards,

  • Mira Ghaly Profile Picture
    11,413 Moderator on at

    @v-xida-msft 

    Does this work for Attachments control?

    ForAll(
    DataCardValue3.Attachments,
    Collect(
    FilesData,
    {
    Name: ThisRecord.Name,
    Value: Substitute(JSON(ThisRecord.Value,JSONFormat.IncludeBinaryData),"""", "")

    }
    )
    );

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard