Reputation: 21
I am trying to upload a ".wav" (circa 32kB) file from the flash memory of ESP32 to Google Drive. Is there a way to do that and would you be able to suggest a way to approach this? I am currently trying to use a code that does the same thing, but with ESP-cam images, and the encoding is very confusing.
The way this code works like:
What I am trying to do:
I am desperately trying to replace the "fb" structure with a file created by SPIFFS.open(). The image in the code below is taken from the structure in the first two lines of the code, I struggle to understand this part the most.
Thank you for any help!
Source: Upload an image directly from ESP32-CAM to Google Driv
char *input = (char *)fb->buf;
char output[base64_enc_len(3)];
String imageFile = "";
for (int i=0;i<fb->len;i++) {
base64_encode(output, (input++), 3);
if (i%3==0) imageFile += urlencode(String(output));
}
String Data = myFilename+mimeType+myImage;
esp_camera_fb_return(fb);
Serial.println("Send a captured image to Google Drive.");
client.println("POST " + myScript + " HTTP/1.1");
client.println("Host: " + String(myDomain));
client.println("Content-Length: " + String(Data.length()+imageFile.length()));
client.println("Content-Type: application/x-www-form-urlencoded");
client.println();
client.print(Data);
int Index;
for (Index = 0; Index < imageFile.length(); Index = Index+1000) {
client.print(imageFile.substring(Index, Index+1000));
}
Upvotes: 1
Views: 1237