ESP32 Audio Using SPIFFS / FSBrowser

rajivramroop
Posts: 1
Joined: Wed Mar 23, 2022 9:52 pm

ESP32 Audio Using SPIFFS / FSBrowser

Postby rajivramroop » Wed Mar 23, 2022 10:01 pm

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

Who is online

Users browsing this forum: Usama Masood and 122 guests