const char ContentOne[] PROGMEM = "......";
const char ContentTwo[] PROGMEM = "......";
httpServer.setContentLength(strlen_P(ContentOne) + strlen_P(ContentTwo));
httpServer.send(200, "text/html", "" );
httpServer.sendContent_P( ContentOne );
httpServer.sendContent_P( ContentTwo );
Moderator: igrr
Me-no-dev wrote:Code: Select allconst char ContentOne[] PROGMEM = "......";
const char ContentTwo[] PROGMEM = "......";
httpServer.setContentLength(strlen_P(ContentOne) + strlen_P(ContentTwo));
httpServer.send(200, "text/html", "" );
httpServer.sendContent_P( ContentOne );
httpServer.sendContent_P( ContentTwo );
Why so late man? I did not see the 'setContentLength()' method. So I had to add another method headers :
void ESP8266WebServer::sendDefaultHeaders(int code, const char* content_type, size_t contentLength) {
String header;
_prepareHeader(header, code, content_type, contentLength);
sendContent(header);
}
Thanks for the knowledge though.
Limitation of your suggested method is that I have to setContentLength for everytime i send some multipart data, plus extra function calls.
Arduino Uno
Raspberry pi 2
ESP8266-01
ESP8266-12E
Like in the example given by @me-no-dev, between the two PROGMEM contents, we can add some dynamic content coming from sensors for example.