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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Restrict double file e...
Power Pages
Answered

Restrict double file extension upload to portals

(0) ShareShare
ReportReport
Posted on by 57

Hi Guys,

 

I would like to prevent certain file types which are basically double file extension to not be uploaded in the Portal application. (e.g. abc.exe.txt). Can you kindly guide me how to achieve that in portal without using Jquery. I have following configuration in the Form's additional settings for configuring notes. However, I do not see how I can restrict double file extension here or in the Entity Form Metadata.

 

Attach File - Yes

Attach File Storage Location - Note Attachment

Allow Multiple Files - Yes

Accept MIME Types - application/pdf;image/jpeg;image/png

Accept File Types - .xlsx,.xls,.doc,.docx,.ppt,.pptx,.txt,.pdf,.csv,.pps

Categories:
I have the same question (0)
  • Verified answer
    oliver.rodrigues Profile Picture
    9,368 Most Valuable Professional on at

    I am doing similar to one of my Portals, but basically the idea is to reject certain characters from the file name.. you can probably use same logic to validate the extension

     

    I am using that function in the usual form validator 

     

    InvalidFilenameValidationError = function (inputName, errorMessage) {
     var invalidCharacters = ['#', '%', '*', ':', '<', '>', '?', '/', '|', '\''];
     var files = $("#" + inputName)[0].files;
     //check that files has correct names
     for (var i = 0; i < files.length; i++) {
     var file = files[i];
     for (var character = 0; character < invalidCharacters.length; character++) {
     if (file.name.indexOf(invalidCharacters[character]) > -1) {
     // show error message here
     return false;
     }
     }
     }
     return true;
    };

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 74 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 55

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard