Uploading .wav file to Ingestion API

I’m trying to build a website where users can upload a .wav file, which I then upload to Edge Impulse through the Ingestion API. Here is the html/javascript code I wrote:

When I test it out, I get an error with code 500 that says “unexpected request”. I suspect that something is wrong with the request, since when I inspect the network it says that the request header has content-type “multipart/form-data”, while the response header has content-type “application/json”:

Is there something wrong with my code, or is what I’m trying to do not allowed by the Ingestion API?
Project ID:

Context/Use case:

You may need the following in the header documented here:

'Content-Type': multipart/form-data

Also try running the Curl command so we can eliminate possible side effects from you custom code. 1st things 1st: get the ingestion working then move on from there.

Thanks for the reply. When I try to include the content-type in the header, I get an error that says “Multipart: Boundary not found”. From what I’ve read online, the browser is supposed to automatically set the content-type as well as the boundary.

I cannot reproduce your error but the follwoing works for me:

curl -X POST -H "x-api-key: ei_DEADBEEF89ABCDEF0123456789ABCDEF0123456789ABCDEF01234567DEADBEEF" -H "x-label: Zero" -H "Content-Type: multipart/form-data" -F "data=@0.wav" https://ingestion.edgeimpulse.com/api/training/files
  • Make sure to use the API Key not the HMAC Key.