I am working on a REST call that has a body that accepts a application/octet-stream.
I need to use this API to send an image that from a "src" atributte from an HTML element:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAA ... AAAAAElFTkSuQmCC">
How can i convert this type of data to send trough this API?
API:
$.ajax({
url: url,
async: false,
contentType: 'application/octet-stream',
method: 'POST',
data: imgData,
processData: false,
success: function(data) {
//Do something
}
error: function(x, e, s) {
//Do something
}
});
I tried to use the function provided in here. It completes the call, but the file on the other part is not saved as a image file.