HTML文件图像输入是使用Chrome的iPhone上的空白屏幕

问题描述 投票:0回答:1

我正在使用以下代码来接受我网站上的图像输入

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

[在Android上的Chrome上运行正常,但在Chrome上的iPhone上我明白了。知道为什么它不能在iPhone上的Chrome上运行吗?

enter image description here

html google-chrome file-io
1个回答
0
投票

尝试一下

<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);
© www.soinside.com 2019 - 2024. All rights reserved.