Links

Parse Uploaded File Names

Allow the user to choose one of the uploaded files

Overview

In this example, the user must upload multiple identification files and then choose which one is their driver's license.
This rule runs on the field value changed event and the file upload control is the specific field change that triggers the rule to run.

Rule Logic

The logic gets the file names of the uploaded files and sets the options of the license dropdown with the file names.
// When the identifcation file upload changes
// get the names of the uploaded files and add them
// as options to the dropdown.
// Upload files are an array of javascript promises that
// resolve to javascript file opjects.
// Wait for all to resolve.
Promise.all(FileUploadIdentificationDocs.value).then((files) => {
const fileNames = [];
// collect the file names
files.forEach(file => fileNames.push(file.name));
// Set the file names array as the options for the dropdown field.
LicenseDropdown.options = fileNames;
});