or upload it to the server with an Ajax request:
// Create a new FormData
const formData = new FormData();
formData.append('image', blob, 'filename');
// Create new Ajax request
const req = new XMLHttpRequest();
req.open('POST', '/path/to/back-end', true);
// Handle the events
req.onload = function () {
if (req.status >= 200 && req.status < 400) {
const res = req.responseText;
// Do something with the response
// ...
}
};
// Send it
req.send(formData);