How can I limit the total size of all uploaded files?

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. Additionally, you can use a simple calculation to limit the total size of all uploaded files combined.

To limit the total size of all uploaded files in a File Upload field:

  1. Add a Calculation field to your form labelled ‘File Total’. Set the field type to Number.

  2. Use the following expression to calculate the total size of all the files in your File Upload field: =(PhotoOfPet.Sum(Size) / 1024 /1000) Make sure to replace ‘PhotoOfPet’ with the name of the File Upload field on your form.

  3. In your File Upload field settings, select Show Custom Error - When and set the custom error to appear when the File Total field 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.”).
    chrome_uiTlfANicC.png

  4. Save your changes. Now, an error message will appear when the total file size is exceeded.
    chrome_PYuRfi2awe.png

Learn more in our Calculations guide.