How to restrict file type (e.g. .pdf) using thymeleaf? : How to restrict file type (e.g. .pdf) using thymeleaf? The accept tag does not serve the purpose fully, as I can type some other file type and the file gets uploaded. The field is of input type "file". Is there any thymeleaf tag that can serve the purpose?