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 / 413 Error on power pag...
Power Pages
Answered

413 Error on power page form with file attachment

(0) ShareShare
ReportReport
Posted on by 12

Hello,

 

I am working on a contact us form that has a file attachment option. We have a maximum file size set to 20mb and have a message set in case the file is too large.

 

When we submit an image that is somewhat larger than this limit (around 30mb), the error message is displayed. However, much larger files (I tested with a >100mb file) instead causes the site to display a 413 error, stating the file is too large. Is there another configuration that is needed for this change to reflect for all file sizes?

Categories:
I have the same question (0)
  • Fubar Profile Picture
    8,503 Super User 2026 Season 1 on at

    Dataverse has a max file size also, by default is set to about 5Mb but can be increased to about 120, your setting on the File Attachment config will need to be less than what the Dataverse size is set to.  It is set under the advanced settings see under  Set file size limit for attachments (note: whilst it is grouped with email it applies to more than just email) https://learn.microsoft.com/en-us/power-platform/admin/system-settings-dialog-box-email-tab

     

  • Verified answer
    BlakeB123 Profile Picture
    12 on at

    I was able to figure it out a way to prevent customer from seeing the error by using page validator function in javascript.

     

     

    function pagevalidate_attachsize(msg) {
     if (typeof (Page_Validators) == 'undefined') return;
     var newValidator = document.createElement('span');
     newValidator.style.display = "none";
     newValidator.id = "attach_size";
     newValidator.controltovalidate = "attachfield";
     newValidator.errormessage = "The file is too big";
     newValidator.validationGroup = ""; // Set this if you have set ValidationGroup on the form
     newValidator.initialvalue = "";
     
     newValidator.evaluationfunction = function () {
     var fa = $("input[type='file']");
     if(fa != null) {
     if(fa[0].files.length > 0) {
     for(var i = 0; i < fa[0].files.length; i++) {
     var file = fa[0].files[i];
     if(file.size > 13210000) {
     return false;
     }
     }
     }
     }
     return true;
     };
     Page_Validators.push(newValidator); });
    }

     

     

    Page Validator logic: https://powerusers.microsoft.com/t5/Customize-Extend/Custom-Form-Input-Validation-on-a-single-field/td-p/2406837

  • BlakeB123 Profile Picture
    12 on at

    @Fubar

    Thank you for the response. I tried it out but it didn't appear to work.... I set the max file size in advanced settings a little bit above the max file size on the form but I was still receiving the 413 error.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 46

#2
Valantis Profile Picture

Valantis 24

#2
omkarsupreme Profile Picture

omkarsupreme 24

Last 30 days Overall leaderboard