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

11,686

Solution 1

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.

Solution 2

For multiple file uploads:

<input capture="camera" accept="image/*" multiple="multiple" type="file" name="photo" id="photo" value="" />
Share:
11,686
mikemaccana
Author by

mikemaccana

I help verify websites for EV HTTPS at CertSimple and have made a bunch of tech products in the past 20 years as a product manager, CTO, lead developer, systems engineer, and technical architect - see https://mikemaccana.com

Updated on June 03, 2022

Comments

  • mikemaccana
    mikemaccana almost 2 years

    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?