To make a file input accept only some file types with HTML, we set the accept
attribute.
For instance, we write
<input
type="file"
name="foo"
accept="application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint,
text/plain, application/pdf, image/*"
/>
to add the accept attribute and set it to a list of MIME types that the file input accepts separated by commas.