html input type file accept only pdf code example
Example 1: input type file allow only pdf
<input type="file" id="test" name="test" accept=".pdf,.doc"/>
Example 2:
<input name="userfile" type="file" accept="application/pdf, application/vnd.ms-excel" />