html - HTML File image input is blank screen on iPhone using Chrome
问题描述
I am using the following code to accept image input in my website
<input type="file" id="qrFile" accept="image/*" />
On Chrome in Android it works fine but on iPhone in Chrome I get this. Any idea why it won't work on Chrome on the iPhone?
解决方案
尝试这个
<input id="myFileInput" type="file" accept="image/*;capture=camera">
var myInput = document.getElementById('myFileInput');
function sendPic() {
var file = myInput.files[0];
// Send file here either by adding it to a `FormData` object
// and sending that via XHR, or by simply passing the file into
// the `send` method of an XHR instance.
}
myInput.addEventListener('change', sendPic, false);
推荐阅读
- go - 如何对消耗 gcloud 存储的代码进行单元测试?
- c# - 更改页眉区域的文本
- sql - 当行重复时,SQL 选择合并键字段
- css - SCSS 将网格区域值视为数学运算
- javascript - React 子组件接收对象。为什么仅更改对象的一个属性时没有视觉更新?
- flutter - 如何在不导航到颤振路线的情况下传递参数
- javascript - 如何在没有绿屏的情况下从浏览器中的网络摄像头输入中删除背景?
- react-native - 导航 v5 React Native
- python - 将 csv 转换为 json 文件格式但没有得到预期的输出
- spring-boot - 如何在多项目中构建子项目