Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mobile safari crashing while capturing photo using input type = file

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"/>

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 ?

like image 730
V-Xtreme Avatar asked Mar 24 '15 05:03

V-Xtreme


1 Answers

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/*">

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.

like image 95
kEph13 Avatar answered Sep 28 '22 22:09

kEph13