Which attribute enables selecting multiple files via the File API?

Prepare for the uCertify CIW Advanced HTML5 and CSS3 Specialist Exam. Dive into essential topics with flashcards and multiple-choice questions. Enhance your understanding with hints and explanations for each question. Pass your exam confidently!

Multiple Choice

Which attribute enables selecting multiple files via the File API?

Explanation:
The ability to pick more than one file with the File API comes from the multiple attribute on the file input. This boolean attribute is simply present on the element, and its presence enables multi-file selection in the browser’s file picker. With multiple enabled, users can select several files at once (for example, by holding Ctrl or Shift while clicking or by dragging files into the picker, depending on the browser). Once files are selected, you access them through the input’s files collection, a FileList containing all chosen File objects; you can loop over it to read each file’s name, size, type, and so on. If the multiple attribute isn’t present, only a single file can be selected and the FileList will have just one File. The other attributes don’t enable multi-file selection: accept restricts which file types are allowed, disabled prevents interaction with the control, and required requires a value before submitting.

The ability to pick more than one file with the File API comes from the multiple attribute on the file input. This boolean attribute is simply present on the element, and its presence enables multi-file selection in the browser’s file picker. With multiple enabled, users can select several files at once (for example, by holding Ctrl or Shift while clicking or by dragging files into the picker, depending on the browser). Once files are selected, you access them through the input’s files collection, a FileList containing all chosen File objects; you can loop over it to read each file’s name, size, type, and so on. If the multiple attribute isn’t present, only a single file can be selected and the FileList will have just one File. The other attributes don’t enable multi-file selection: accept restricts which file types are allowed, disabled prevents interaction with the control, and required requires a value before submitting.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy