I am struggling to successfully send our audio file from the UI using the provided code snippet:
var url = (window.URL || window.webkitURL).createObjectURL(blob);
var link = document.getElementById("save");
link.href = url;
link.download = filename || 'output.wav';
var fd = new FormData();
fd.append('fname', 'sample1.wav');
fd.append('data', blob);
$.ajax({
type: 'POST',
url: 'AudioToText',
data: fd,
processData: false,
contentType: "audio/wav"
});
We are facing difficulties in processing this on the servlet side. I would appreciate any assistance with JavaScript code for sending an audio file to a servlet, as well as the servlet code necessary to save that audio file on the server. Thank you in advance.