Since a file can be loaded via Drag & Drop, it is not possible
to use the native required attribute to check for mandatory files.
However, this check can be performed using the data-has-values attribute
added dynamically to the .fupl-wrapper element.
First, mark an uploader as required adding the relative attribute to the original
input[type=file] element (you can also add the data-required="true"
attribute to the main uploader container).
Then, check for data-has-values (true or false)
on form submit.
You can use the src-utilities/check_required_uploader.js script
to quickly add a check function. The script is also located in the
dist/utilities folder as ESM and UMD.
Look for more info at Recipes: required Uploader in the README page.
To test the script, submit the form without the required image.
Take a look at the "About the demo" section in the README file for info about the following code boxes.