input type=“file” 在移动端H5页面实现调用本地

2021-09-23  本文已影响0人  一名有马甲线的程序媛
<input type="file" accept="image/*" mutiple="mutiple" capture="camera" />

三个属性

几种写法

  1. ios 和 安卓都可以调用摄像头
<input type="file" accept="image/*" mutiple="mutiple" capture="camera" />
  1. 在安卓无法调用摄像头
<input type="file" name="upload" accept="image/png,image/jpeg,image/gif" capture="camera"> 
  1. 在安卓微信会出现 "No apps can perform this action" ;
    在uc浏览器正常;
    ios能正常使用;
    pc端可以使用。
<input type="file" accept=".gif,.jpg,.png,.jpeg,.bmp" name="file" />
  1. 调用相机
<input type="file" accept="image/*" capture="camera">
  1. 调用摄像机
<input type="file" accept="video/*" capture="camcorder">
  1. 调用录音机
<input type="file" accept="audio/*" capture="microphone">
  1. 不加上capture,则只会显示相应的
// 拍照或图库
<input type="file" accept="image/*" >

// 录像或图库
<input type="file" accept="video/*" >

// 录像或拍照或图库
<input type="file" accept="audio/*" >

点击查看原文

本文会持续更新,尽情期待~ 点击查看 好心小萍宝 的全部简书

上一篇 下一篇

猜你喜欢

热点阅读