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 Pages / Restrict Note file upload
Power Pages
Unanswered

Restrict Note file upload

(0) ShareShare
ReportReport
Posted on by 91

Hi - newbie here

 

I have seen some JS code which validates file upload type using an array of accepted types. However, I'm not sure how to apply this to the 'Add Note' file upload option - the pop up window which allows you to add a note and attach a file. I'm not sure how to reference it in the script. Our portal isn't using the file attachment option, so this is the only part we need to apply it to.

 

The MIME type restriction in Portal Manager doesn't seem to function as expected.

 

Any thoughts? 

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

    I have in my clipboard a function that might be helpful, I just answer this on a different thread, basically it's a validation on filenames:

    portalUtils.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) {
     PortalUtils.ShowFormValidationError(errorMessage, null, null, null, true);
     return false;
     }
     }
     }
     return true;
    }; 
  • RK2021 Profile Picture
    91 on at

    Thanks @OliverRodrigues - I have added to the JS box on additional settings tab of form, but nothing seems to occur. Am I missing something to enable it?

  • oliver.rodrigues Profile Picture
    9,455 Most Valuable Professional on at

    can you share your code or configuration snapshots? 

    how are you calling my example function? 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
rezarizvii Profile Picture

rezarizvii 64

#2
DP_Prabh Profile Picture

DP_Prabh 34

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 30 Most Valuable Professional

Last 30 days Overall leaderboard