webcamjs icon indicating copy to clipboard operation
webcamjs copied to clipboard

Add headers, form data options when upload snap.

Open t-walker-wei opened this issue 4 years ago • 1 comments

Add form data, request headers when upload snap. Call: Webcam.upload(image_data_uri, target_url, post_data, callback, headers) post_data and headers are js objects and optional.

t-walker-wei avatar Mar 19 '20 06:03 t-walker-wei

in Laravel you must add csrf_token() to prevent page expired (419 error)

function saveSnap(){ var base64image = document.getElementById("imageprev").src; Webcam.upload( base64image, 'url',{ _token: "{{csrf_token()}}"}, function(code, text) { document.getElementById("id_image").value = text; }); } #

bgxerjoe avatar Aug 08 '21 06:08 bgxerjoe