cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AkshayAuradkar
Frequent Visitor

how to restrict the attachment type only to jpeg or png in power apps

Hello Experts, my requirement is to restrict the file type only to jpg or png when attached can you please help i have a datacard and the the data source is sharepoint

4 REPLIES 4
rsaikrishna
Community Champion
Community Champion

@AkshayAuradkar 

 

There is no property in the Attachments control allows us to limit the file types. But, there are multiple workarounds you can try:

 

Workaround #1:  On Submit of the form, check the file types from Attachment control. If any attachments contains unsupported file types, show an error. Reference blog article: https://www.about365.nl/2019/12/10/enforcing-file-types-in-power-apps-attachment-control/

 

Workaround #2: Place a label in the data card and set its vibility based on file type condition as discussed in the following post:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Allow-only-some-file-types-as-attachments/td...

 

Workaround #3: Attachments control has OnAddFile property. While adding file, you can check the file type and show a label if the file type is not supported.

 

I hope these work around will help you.

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

 

hi i tried the second method but getting the errorerror.png

@AkshayAuradkar 

 

Give a try with following:

 

If(Not(".pdf" in Concat(<AttachmentControl>.Attachments.Name,Name&",")),true)

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

 

hi krishna thanks for the quick reply

i tried onselect of the button

 

If(
Last(
Split(
First(
DataCardValue110.Attachments
)
.Name,
"."
)
)
.Result = ".png" or ".jpg",
SubmitForm(Form6),
Notify("Only PNGs allowed")
)

 

it is working for png i want png or jpg can you please help me with the syntax thank you

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (1,421)