使用输入类型=文件捕获照片时,移动Safari浏览器崩溃 [英] Mobile safari crashing while capturing photo using input type = file
问题描述
我正在使用输入类型文件在iOS中启动相机.我正在使用的以下代码行:
I am using input type file for launching the camera in iOS . The following line of code I am using :
<input type="file" name="select a Picture"/>
当我按下按钮时,它显示两个选项,即1)拍照2.从图库中选择 如果我选择从画廊中选择"选项,则当我从画廊中选择图片时,它将启动本机画廊,因此我可以在预览中看到它,因此从画廊中选择"工作正常.
When I press the button it shows two option i.e. 1) Take a Picture 2. Choose from the gallery If I select option Choose from the gallery then it launches the native gallery when I select the picture from the gallery then I can see it in the preview , so choose from gallery is working fine .
但是问题在于使用相机拍照.当我按拍照时,它会启动相机,但是在拍摄完照片后,它会直接返回到野生动物园.并弹出其中显示以下错误:
But the problem is with taking picture using camera . When I Press the take picture it launches the camera but it after capturing the photo it directly goes back to the safari . And there is pop of which shows the following error:
A problem occurred with this webpage so it was reloaded
那么如何克服这个问题呢?
so how to overcome this issue ?
推荐答案
就我而言,添加name ="属性可解决此问题.我有:
In my case, adding a name="" attribute fixed the problem. I had:
<input id="uploadPhotoInput" type="file" capture="camera" accept="image/*">
,并且每次都崩溃.更改为:
and it crashed every time. Changing it to:
<input id="uploadPhotoInput" name="uploadPhotoInput" type="file" capture="camera" accept="image/*">
似乎已经完成了the俩.我不知道为什么,因为我没有以任何形式提交它,但是确实如此.
seems to have done the trick. I have no idea why, since I wasn't submitting it in a form or anything, but there it is.
这篇关于使用输入类型=文件捕获照片时,移动Safari浏览器崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!