Send file in chunks as POST request - ESP8266

154 Views Asked by At

sorry for bother again, im having some trouble in chunk some files to send them as a POST request. I made this function to post text to dpaste.com:

void dpaste_create(WiFiClientSecure *client, HTTPClient *http, String title, String data) {
  http->begin(*client, "https://dpaste.com/api/");
  http->addHeader("Authorization", "TOKEN");
  http->addHeader("Content-type", "application/x-www-form-urlencoded");
  http->POST("content=" + data + "&title=" + title + "&expiry_days=30");
  Serial.printf("[DEBUG]: %s\n", http->getString().c_str());
  http->end();
}

But now im trying to send the data of a file (400kb) but i only have 40kb of ram. Any have some idea how to chunk and send the sizes with "Transfer-Encoding: chunked"?

Any suggestion is appreciated. Thanks a lot for the time.

0

There are 0 best solutions below