cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
C3
Level: Powered On

AddPicture control and Azure Blob storage

Hi.

 

One of the requirement of my powerapp is to save attachments of any type. These files shall be saved to a Azure blob storage.

The only file upload controller I have found is the Add Picture control.

 

I had a look at this blog post:

https://powerapps.microsoft.com/en-us/blog/upload-files-from-powerapps-using-the-azure-blob-storage-...

This had the same functionality as i wanted.

 

My issue is that I can't get the file name of the selected file.

This is needed for mime type etc.

The AzureBlobStorage.CreateFile requires a file name with extension

AzureBlobStorage.CreateFile("MyFolder", "MyFileName.txt", AddMediaButton1.Media)

In the blog above, the author had a separate text field the user had to type in a file name. That is not good, if user types in the wrong file extension the mime type will be wrong. Causing problems to view the file.

 

So where can I get this?

The AddMediaButton is just a input type=file html element.

The value property of the input element is the file name. In fact, it's the same html element used to add attachments to messages on this forum. Only difference is the css class and the accept= "image/*" that selects default file types to images.

Html.jpg

 

stupidity.jpg

Since the html input type="file" value property is the file name, where can I get this value from an AddPicture control?

Why is PowerApps so into images/media and not what ever file type? 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: AddPicture control and Azure Blob storage

Hi @C3,

Do you want to get the file name of a selected file captured via the Add picture control?

 

If you want to get the file name of a selected file captured via the the Add picture control, I afraid that there is no way to achieve your needs in PowerApps currently.

 

Currently, within PowerApps, we could only get the content (blob data rather than binary data) of the uploaded image captured via the Add picture control. 

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Community Support Team
Community Support Team

Re: AddPicture control and Azure Blob storage

Hi @C3,

Do you want to get the file name of a selected file captured via the Add picture control?

 

If you want to get the file name of a selected file captured via the the Add picture control, I afraid that there is no way to achieve your needs in PowerApps currently.

 

Currently, within PowerApps, we could only get the content (blob data rather than binary data) of the uploaded image captured via the Add picture control. 

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

TopShelf-MSFT
Level 10

Re: AddPicture control and Azure Blob storage

hi @C3 please review the above response and reply back with any further assistance you require. 

 

Thank you.

 

@TopShelf-MSFT

Highlighted
TomBertie
Level: Powered On

Re: AddPicture control and Azure Blob storage

Hi @C3,

 

I've really struggled with this as well.  I have an Azure Blob storage container that I need to add the files to, the files can be of any type, and I don't want user to have to specify the file name after they have selected it (it would create a riot!).

I ended up coming up with a fairly inefficient workround using the Attachment Control, a Sharepoint List as a cache, and a few flows.  I wanted to keep a record of the attachments in the Azure SQL database so that I can associate them with various other records, and also decided to obfuscate the filenames in Azure Blob partly to hide them but mainly to avoid a clash between multiple identical filenames in a single container.  My approach using pseudocode (which works, albeit with some performance issues) is as follows:

Pre-work:
Use Patch to create a new list item with title GUID() and return the Id // This is the temporary list item to cache documents
If files exist for the record in Azure Blob(

    Copy the files from Blob to Sharepoint list using a Flow, and renaming the files to the correct name in the process)

Open Screen with form and attachment control bound to the temporary list item

On Submit: // Using a submit button
Delete all the old attachments for the record from Blob storage
Delete all records relating to old attachments from SQL database

Forall(Temporary Sharepoint List Item.'{Attachments}',
    Copy the file from Sharepoint list to Blob storage using flow, renaming the files to GUID for obfuscation in the process
    Update SQL record to record the original filename and Blob GUID filename for later recovery
Delete the Temporary Sharepoint List Item

 

Over time I may play around with OnAddFile, OnRemoveFile, and OnUndoRemoveFile to only handle the changes on submission.  

 

This is a ghastley workround, and we urgently need general filepicker that returns a file content, as well as basic things like file names, so that we can then upload it to our chosen location (MICROSOFT please note).  But it works for me in the meantime.

 

Yours, Tom

Dong
Level: Power Up

Re: AddPicture control and Azure Blob storage

Has this issue been addressed yet? Are their plans in place to do so? 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,322)