Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making an iOS file input go directly to the camera app?

Background: iOS 6.1, at the time of writing, doesn't allow both multiple file selection and taking a photo in a single input.

Since my main app already has a multiple input picker for choosing files, I'd like to add a second button (only required by, and only shown on) iOS devices to start the camera.

This currently works with:

<input type="file" class="ios_only" accept="image/*;capture=camera">

However iOS Safari always gives the following dialog:

iOS 'take photo' or 'choose exiting' dialog

Is there a way the <input> can be made to go directly to the camera without this prompt?

like image 349
mikemaccana Avatar asked May 22 '13 09:05

mikemaccana


2 Answers

No, you can't. Safari handles this as an UIImagePickerView and has to choose the source by this UIActionSheet.

For your information, this line has the same effect:

<input type="file" class="ios_only" accept="image/*" capture="camera">

Tested also in iOS 7.

like image 191
Raptor Avatar answered Sep 28 '22 09:09

Raptor


For multiple file uploads:

<input capture="camera" accept="image/*" multiple="multiple" type="file" name="photo" id="photo" value="" />
like image 45
josdev Avatar answered Sep 28 '22 08:09

josdev