The standard File Field element in the CFV5 Designer tab allows the user to select a single file. This FAQ tells you how to configure the element and the other form settings to allow more that one file to be selected and uploaded at the same time.
In the Designer tab drag a File Field element into your form and open the Edit settings:
- Give the element a Field Name and add [] at the end to make it an array name e.g. my_photos[]
- Scroll down and set Multiple to Yes
- Add a label and any other settings as usual
- Save the element
In the Setup add a Files Upload action to the form On Submit event. This should be after any Check or Validation actions and before any Email, DB Save or Multi Page actions. Open the Edit settings:
- In the Files Config box add the element name - without the [] - e.g. my_photos:jpg-png
- Scroll down to the Array Fields box and add the element name there as well - without the [] - e.g. my_photos
- Add any other settings - including any other File Field elements.
- Save the action
If you are saving the file names to a database table, or including then in an email then add a Handle Arrays action after the Upload Files action and before the Email or DB Save actions.
If you want to attach the files to an email add the element name in the Attachments box - without the [] - e.g. my_photos
Save the form and test.
Using more than one File Field element
As well as using one File Field element to select multiple files you can use several File Field elements with the same array name. But note that the File Type validation set in the Files Upload action will be the same for all of them
In the Designer tab
- Add the File Field elements and give them each an array name e.g. my_photos[] (and a unique id e.g. my_photos_1).
- Set the Multiple setting to Yes in each of them