zoukankan      html  css  js  c++  java
  • input accept属性限制文件上传格式

    上传文件的类型;具体做法如下所示:

    注意:accept属性可以限制上传格式,其有兼容性如下

    《1》上传.csv格式的

    <input text="file" accept=".csv" />

    《2》上传.xls格式

    <input text="file"  accept="application/vnd.ms-excel"/>

    《3》上传.xslx格式

    <input text="fiel" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"/>

    《4》上传.png/.jpg/etc格式

    <input type="file" accept="text/plain" />

    《5》上传图片格式

    <input type="file" accept="image/*" />

    《6》上传.htm,.html格式

    <input type="file" accept="text/html" />

    《7》上传video(.avi, .mpg, .mpeg, .mp4)格式

    <input type="file" accept="video/*" />

    《8》上传audio(.mp3, .wav, etc)格式

    <input type="file" accept="audio/*" />

    《9》上传.pdf格式

    <input type="file" accept=".pdf" />

    《10》如果限制两种文件格式,同时限制

    <input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel">

    注意:以逗号分隔开

  • 相关阅读:
    POJ 2251 Dungeon Master
    POJ1321棋盘问题
    CODE[VS] 1003 电话连线
    CCF-201412-1-门禁系统
    CCF-201412-2-Z字形扫描
    为什么要用补码
    CCF-201409-1-相邻数对
    CCF-201409-2-画图
    CCF-201403-1-相反数
    CCF-201403-2-窗口
  • 原文地址:https://www.cnblogs.com/mmzuo-798/p/9685994.html
Copyright © 2011-2022 走看看