user1760150
user1760150

Reputation: 644

only accept newly created input file upload

In my web application I'm trying to have the user take a picture of themselves from their camera. I've been using this:

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

This works nicely, however I need it to ONLY allow a picture taken right then from their camera. If the user can pick an already existing picture then it defeats it's purpose. Cuz I'm basically trying to verify the identity of the person using the phone at the time they submit this form. The above HTML seems like it does what I want on my Android phone (goes straight to camera), however on an iphone it gave the user the option to choose an existing file. I read here that this is unavoidable: Allow only access to camera device in HTML5

My question is this, would it be good enough to check the files last modified date, to see if the pic was created \ modified close to the time of upload? I guess they could modify the file right before they uploaded it though right? Checking the modified date would make it a little more secure but deff not fool proof. Is there any way I can make it so only photos taken right then are accepted?

Upvotes: 0

Views: 71

Answers (1)

octavn
octavn

Reputation: 3285

iOS6 through 10 do not support the capture attribute which is meant to force the user agent to use the camera, not the file system.

PS: You could improve your code by replacing capture="camera" with just capture. In 2012 the capture attribute became a boolean in the HTML Media Capture spec.

Upvotes: 1

Related Questions