在上传文件的时候,需要限制指定的文件类型。 <input type="file" accept="image/*" />
accept可以指定如下信息:
除了以上的类型外,后各文档如docx需配置的accept属性值如下:
Extension MIME Type.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xltx application/vnd.openxmlformats-officedocument.spreadsheetml.template.potx application/vnd.openxmlformats-officedocument.presentationml.template.ppsx application/vnd.openxmlformats-officedocument.presentationml.slideshow.pptx application/vnd.openxmlformats-officedocument.presentationml.presentation.sldx application/vnd.openxmlformats-officedocument.presentationml.slide.docx application/vnd.openxmlformats-officedocument.wordprocessingml.document.dotx application/vnd.openxmlformats-officedocument.wordprocessingml.template.xlsm application/vnd.ms-excel.addin.macroEnabled.12.xlsb application/vnd.ms-excel.sheet.binary.macroEnabled.12