All Collections
Examples & Tutorials
Restrict the number of files that can be uploaded
Restrict the number of files that can be uploaded

Let's explore how you can restrict the number of files that can be uploaded to SharePoint

Updated over a week ago

The file componet is a powerful feature that allows users to upload multiple files directly to your SharePoint site, however it can sometimes be useful to restict the number of files a user is allowed to upload in a single submisisons. In this article we will outline two options to achive this.

  1. Using multiple file component set to only allow a sinlge upload.

  2. Using a file component allowing multiple uploads but with a custom validation rule to prevent submission if too many files are detected.

Option 1 - Multiple file components

The simplist way to restrict the number of file components would be to simply disable the "Multiple Values" option on your file component and drag and drop multiple file compoents into your form.

  1. Drag and drop a file component into your form

  2. Under the Data tab disable the "Multiple Values" option and save

  3. Repeat this until the number for file components matches your maximum number of permissable files

Option 2 - Validation Rules

Having a single file component configure to allow multiple uploads can improve the look and feel of your form. For this reason, you may want to use a sinlge file component instead of the method outlined in option 1 above. In this secario you can use a custom validation rule to prevent submission if too many files are detected.

  1. Drag and drop a file component into your form

  2. Under the validation tab expand the "custom validation" section

  3. Insert the following custom validation to restrict the number of files to 3

valid = instance.getValue().length < 3

Did this answer your question?