smartphone photo in the HTML file field

Asked

Viewed 49 times

0

Colleagues.

I have a web-based system developed in PHP and this system is mobile compatible. When I click on the file field, it gives the option to use the camera, but when I take a photo, it refreshes the page and does not appear in the field the photo taken. Is that possible? If it is, could anyone help? Thank you.

1 answer

0

This post is very similar to yours. Take a look.

https://stackoverflow.com/questions/17241707/using-form-input-to-access-camera-and-immediately-upload-photos-using-web-app

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

var myInput = document.getElementById('myFileInput');

function sendPic() {
  var file = myInput.files[0];

  // Send file here either by adding it to a `FormData` object 
  // and sending that via XHR, or by simply passing the file into 
  // the `send` method of an XHR instance.
}

myInput.addEventListener('change', sendPic, false);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.