I have a javascript code that basically displays a recording menu that allows you to record your voice, and then I added that on stop you can click to send the file to airtable. But I keep getting 422 error. I read somewhere that when sending attachment it need to be on publicly available url. Any ideas how can I solve this?
$.ajax({
url: apiUrl,
type: 'PUT',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'multipart/form-data',
},
data: formData,
processData: false,
contentType: false,
success: (response) => {
console.log('Audio uploaded to Airtable successfully:', response);
},
error: (error) => {
console.error('Error uploading audio to Airtable:', error);
}
});
}
--------
const formData = new FormData();
formData.append('Attachments', new File(audioChunks, 'audio.wav'));
---------
My field's name is "attachments"
------------
audioPlayer.src = URL.createObjectURL(audioBlob);