Page 1 of 1

ESP32 Audio Using SPIFFS / FSBrowser

Posted: Wed Mar 23, 2022 10:01 pm
by rajivramroop
Hi, I am having trouble figuring out how to sent a .wav file stored on SPIFFS to a Flask API. Below is a snippet of the code I am using:
HTTPClient http;
//////////////////////////////////////////////////////

http.begin("18.189.19.59:22/predict");
http.addHeader("Content-Type", "text/plain");
http.addHeader("Content-Type", "audio/x-wav");
int httpResponseCode = http.POST("POSTING from ESP32");
int httpAudioResponse = http.POST(name, &fsUploadFile);
Serial.println(httpResponseCode);
Serial.println(httpAudioResponse);
http.end(); //Free resources

///////////////////////////////////////////////////////

However, I put this code in the FSBrowser example and I keep getting the error, "HTTPClient was not declared in this scope". Currently, I am able to run a separate code to collect the data and store it into the SPIFFS buffer, and using FSBrowser (Without the HTTPClient) I am able to download the file directly onto my computer from the ESP's web server.
1) How would I go about sending the correct file from SPIFFS to the API using a POST request?
2) Do i need FS Browser to do this, or is there a more efficient way?

Thank you.

UPDATE: can i do this with an SD card? I figured out sending using UDHTTP