Prevent auto-saving of photos to gallery when uploading photos in Android Browser using input type=file capture=camera Prevent auto-saving of photos to gallery when uploading photos in Android Browser using input type=file capture=camera android android

Prevent auto-saving of photos to gallery when uploading photos in Android Browser using input type=file capture=camera


There's not way to prevent saving.

In web applications, the client-side is sandboxed and for security reasons you cannot control anything outside the scope of your website.

However, you can try this solution (it won't work on all devices):

  • Instead of using a <input> tag, you can implement the camera capture by yourself by using getUserMedia and a <canvas>.
  • Use the <input> method only as a fallback (in case the end-user device doesn't support getUserMedia).

This method will require users to allow the access to the camera, but it won't be saved on user's device because captures are saved into memory.
Also, if you need to save the result to your servers, you'll have to convert the canvas to a data URI and then convert the data URI to a blob and upload the blob through AJAX with multipart/form-data.

I'd recommend to Google "html5 camera getusermedia" for more information.