【问题标题】:select images in html-file-upload, based on image extension type根据图像扩展类型选择 html-file-upload 中的图像
【发布时间】:2014-01-22 03:29:10
【问题描述】:

这似乎对于过滤 image type 以进行文件上传非常有效

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

参考帖: File input 'accept' attribute - is it useful?

这似乎只适用于 Chrome:

<input type="file" name="imagefilename" accept="image/x-png, image/gif, image/jpeg" />

参考帖: How to allow <input type="file"> to accept only image files

问题: 我知道有一些方法可以使用 jQuery 或服务器端验证图像扩展......但是有没有人遇到任何属性,可以通过纯 html5 方式过滤图像,通过添加input type="file" 部分中的某些内容,如果不是跨浏览器,那么至少支持标准浏览器,例如 opera,moz,chrome,safariIE9+????

请注意我要求纯 HTML 方式.....没有变通办法或黑客!!

询问的原因: 引用的线程已经很老了,我在 google 上找不到太多有用的东西....可能有人知道...!! :)

【问题讨论】:

    标签: html image file-upload image-upload


    【解决方案1】:

    据此http://www.w3schools.com/tags/att_input_accept.asp

    Internet Explorer 9 及更早版本不支持标签的接受属性。

    所以你将不得不为旧的 IE 使用 jQuery 或服务器端解决方案。

    【讨论】:

    • 好吧...这是典型的 IE....关于其他人的任何想法(在我的问题中,我也提到了 IE9+)???
    猜你喜欢
    • 2017-03-12
    • 1970-01-01
    • 2012-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-06
    相关资源
    最近更新 更多