Is there a way to add encoded image to the form taken from webcam? I can print image for prewiew, but I need to upload to the server, I have upload form for images, so I need to use same form for uploading camera images (if possible).
var result = cameraApi.save();
$('.items-list').append('<img src=data:image/jpeg;base64,' + result + ' />');
This code is for displaying taken image, please advice how to instantly add it to upload form.
You can’t add random files to
<input type="file">controls. That’s basic browser security, so sites cannot steal files in your hard disk.But you don’t need an upload control at all if you already have the file contents in a JavaScript variable! Just add it to a hidden field or make an AJAX post request.