JSP文件上传限制类型 比如限制只能.doc,.docx,.pdf文件上传 加个属性即可。 input type="file" accept=".doc,.docx,.pdf" class="" name="file1" id="file1" onchange="xxx(this);" style="float:left;display:none;"/> 可以看到文件已经过滤!