If your form has a File Upload field, you can use the Maximum File Size option in the field settings to limit the file size allowed for a single uploaded file. Alternatively, use the calculation below to limit the total size of all uploaded files combined.
To limit the total size of all uploaded files in a File Upload field:
Add a Calculation field to your form labelled ‘File Total’. Set the field type to Number.
Use the following expression to calculate the total size of all the files in your File Upload field. Make sure to replace ‘PhotoOfPet’ with the name of the File Upload field on your form:
=(PhotoOfPet.Sum(Size) / 1024 / 1000)
In your File Upload field settings, select Show Custom Error - When and set a custom error to appear when the File Total field sum exceeds your specified limit. In this case, we’re setting a limit of 17MB (the same limit for file attachments in email notifications and confirmations). Make sure to include a custom error message (ex: “The total file size cannot exceed 17MB.”).
Save your changes. Now, an error message will appear when the total file size is exceeded.
Learn more in our Calculations guide.