【问题标题】:HTML5 Camera input tag not allowing existing image selectionHTML5 相机输入标签不允许现有图像选择
【发布时间】:2017-10-22 04:14:20
【问题描述】:

我正在使用 HTML5 捕获图像输入标签。这是我的输入标签:

<input id="imagesInput" type="file" accept="image/*" capture="camera" class="input-file" multiple>

但是,当我单击此输入时,我会被带到相机。我没有像以前那样获得“选择现有文件”。

我已经在 Ipad 和 Android 手机上进行了测试,结果相同。

有谁知道我是否缺少属性或任何东西?谢谢!

这是一个简单的 jsfiddle 来复制问题。您只会在移动设备上看到此问题: https://jsfiddle.net/u07o1ywx/

【问题讨论】:

    标签: html camera


    【解决方案1】:

    我想通了。 capture="camera" 属性只允许相机上传。通过将其添加到接受属性中,您可以从任一加载。

    <input id="imagesInput" type="file" accept="image/*;capture=camera" class="input-file" multiple>
    

    【讨论】:

    • 实际上,根据最新规范,您应该省略 capture="camera" 部分并使用 &lt;input id="imagesInput" type="file" accept="image/*" class="input-file" multiple&gt; 。有关详细信息,请参阅Correct Syntax for HTML Media Captureaccept="image/*;capture=camera" 来自一个非常旧的规范版本。
    猜你喜欢
    • 2011-05-26
    • 2018-01-07
    • 1970-01-01
    • 2019-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多