1

Can i turn on camera on android device to take and send picture to my webserver when user clicked on input type="file" on mobile version of my website in phone web browser?

Now it starts phone file manager to select image file already stored on sd-card or phone memory.

Can i use phone camera in that case or i strictly need to make app?

Sir D
  • 2,164
  • 2
  • 17
  • 21
  • 1
    You want to allow your web application to access the android device's camera? Is that what you trying to do? – Fawzan Izy Mar 19 '13 at 12:07
  • Yes! That i want to do! But it isn't android app. It's just a mobile version of my website. – Sir D Mar 19 '13 at 12:10
  • 1
    Possible duplicate http://stackoverflow.com/questions/5296644/how-to-start-the-camera-directly-from-a-web-page-in-android – karmafunk Mar 19 '13 at 12:12
  • I don't think this is possible using a server-side scripting. server-side scripting does not have access to client's hardware. – Fawzan Izy Mar 19 '13 at 12:14

1 Answers1

2

Thanks karmafunk for this solution!

Here is the code to get access to the new camera api's in android 3+ and iOS 6.

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

This will allow you to take a new picture or select one from the device library and then upload it to a web app.

Community
  • 1
  • 1
Sir D
  • 2,164
  • 2
  • 17
  • 21
  • 1
    The latest draft of the media capture specification changed the `capture` attribute to a boolean flag, so it does not need a value: http://www.w3.org/TR/html-media-capture/ – l4mpi Mar 19 '13 at 13:01