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
Dual Super User
Dual Super User

@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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,265)