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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Better way to allowing...
Power Apps
Answered

Better way to allowing certain file types to be uploaded

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi everyone,

 

I have the following set up, but for some strange reason its hit and miss.

On my attachment control I want to allow only image file types to be uploaded.

 

I have created a label (LblAttachmentWarning) and its visible property is set to:

 

If(Not(".img" || ".IMG" || ".png" || ".PNG" || ".gif" || ".GIF" || ".jpg" || ".JPG" in Concat(DataCardValue23.Attachments.Name,Name&",")),true)

 and the next buttons visible property on that screen set to:

 

!LblAttachmentWarning.Visible

This seems to randomly work, sometimes I can upload a .GIF and the next button is visible and I can sometimes upload the same image and the label stays visible, so the next button is invisible, is there a better way of achieving my goal or is there an issue in my code?

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,570 Most Valuable Professional on at

    Hi @Anonymous ,

    Put this on the OnAddFile of the Attachment control

    With(
     {
     wExt: 
     Lower(
     Right(
     Last(Self.Attachments).Name,
     3
     )
     )
     },
     If(
     wExt <> "jpg" && wExt <> "png" && wExt <> "gif" && wExt <> "img",
     Notify(
     "Only Image files allowed",
     NotificationType.Error
     );
     Reset(Self)
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @WarrenBelz 

     

    Tried that while in studio mode and it would not allow me to upload any file types the notification appears regardless of it being an img file type

  • WarrenBelz Profile Picture
    156,570 Most Valuable Professional on at

    @Anonymous ,

    Sorry - danger of free-typing without testing.

    Should be And && not Or ||- fixed on original post now.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard