JSFiddle - React, Tailwind, and code Playground
HTML
<input id="myFileInput" type="file" accept="image/*" capture="camera">
JavaScript
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.
console.log(file);
}
myInput.addEventListener('change', sendPic, false);