Would like to disable the user from being able to attach files that are not either, ".doc, .pdf, .xlsx". Trying to upload an ".xlsx" file type.
I have tried the code below found in an old
post, where it checks to see if the extensions are in the name.
ForAll(Self.Attachments,
If(
Not(
Or(
EndsWith(Name, ".docx"),
EndsWith(Name, ".doc"),
EndsWith(Name, ".pdf"),
EndsWith(Name, ".xlsx")
)
),
Notify("Only .docx, .doc, .pdf, or .xlsx file types are allowed", NotificationType.Error);
Reset(Self)
Collect(colAttachments, value)
)
)
Also tried the code below by saving all the attachments into a collection and then trying to remove them from the collection but it deletes all the items in the collection. Printed the name in a data table and the DisplayName does contain the extension.
ClearCollect(colAttachments, Self.Attachments);
RemoveIf(colAttachments, Not(".pdf" in DisplayName) Or Not(".xlsx" in DisplayName))