Thursday 15 April 2010

javascript - Using form input to access camera and immediately upload photos using web app -


I've come across:

From iPhone IOS 6 and Android iCas, in HTML5 Tag that allows you to take a picture from your device:

  & lt; Input type = "file" accept = "image / *" capture = "camera" & gt;   

Capturing can take values ​​like cameras, camcorders and audio.

Is it possible to take this step forward immediately by using one type of ajax, then upload the photo after taking photograph?

For example, using my phone, once I tap on the input, it opens the camera which will allow me to take a picture and save it immediately. When I save it to the camera, it is listed as an input button to upload it.

To be promptly uploaded for the user, what will be the form to click on the submit button for the user?

It's really easy to do this, just send the file to the XHR request from the on-file file input Handler

  & lt; Input id = "myFileInput" type = "file" accept = "image / *; capture = camera" & gt; Var myInput = document.getElementById ('myFileInput'); Function sendPic () {var file = myInput.files [0]; // MyInput.addEventListener ('Change', Send, File, False) by sending the file here in the 'FormData' object or by sending the file via XHR or just sending the file to the 'Send' method of an XHR installation;    

No comments:

Post a Comment