Restrict the number of files that can be uploaded
The File component can upload several files directly to SharePoint. You can limit how many files a responder may include by allowing only one file per component or by adding a custom validation rule.
-
Use several File components that each allow one upload.
-
Use one multiple-value File component with a maximum-count validation rule.
Option 1 - Multiple file components
Section titled “Option 1 - Multiple file components”Disable Multiple Values on a File component when each field should accept only one file. Add as many separate File components as the form requires.
-
Drag and drop a file component into your form
-
Under the Data tab disable the “Multiple Values” option and save
-
Repeat this until the number of File components matches the maximum number of permitted files.
Option 2 - Validation Rules
Section titled “Option 2 - Validation Rules”A single multiple-value File component is often more compact. Add a custom validation rule to prevent submission when it contains too many files.
-
Drag a File component into the form and enable Multiple Values.
-
In the Validation tab, expand Custom Validation.
-
To permit up to three files, enter:
valid = instance.getValue().length <= 3For a different limit, replace 3 with the required maximum. A failed rule prevents submission until enough files are removed.