如何将图像浏览按钮限制为仅白色图像,允许下拉菜单从移动设备上的相机、库、文件中进行选择?
这是发生的事情:
使用时,<input type="file" accept="image/*;capture=camera">
我得到了我需要的下拉菜单,但它不限制图像文件类型 - 它可以是任何内容(*.*)
仅使用<input type="file" accept="image/*" capture>它的图像但没有下拉菜单时。相机直接打开。
如何获取下拉菜单 + image/*?
移动演示。(iPhone 主要需要):
<p>Drop-down for camera, library, files but all files allowed:</p>
<input type="file" accept="image/*;capture=camera">
<p>Only images allowed but doesn't have drop-down. Opens camera directly:</p>
<input type="file" accept="image/*" capture>Run Code Online (Sandbox Code Playgroud)
目前,我正在使用 JS 来限制非图像,但想知道是否有 html5 原生方式。
问了几分钟后就明白了
它应该是逗号,而不是分号;
<p>Drop-down and Images only</p>
<input type="file" accept="capture=camera,image/*">Run Code Online (Sandbox Code Playgroud)
为什么大多数文章和教程都使用;我无法理解的内容:)
| 归档时间: |
|
| 查看次数: |
4697 次 |
| 最近记录: |