Files
ESPEasy/src/WebServer_DownloadPage.ino
T
Gijs Noorlander da4bb18c7b [ESP32] Rename WebServer object to web_server to fix build issues
ESP32's WebServer class has the same name as our global object had.
So you could only define it in ESPEasy.ino.

Now it is renamed to `web_server` and now ESP32 and ESP8266 will happily build with the global object defined in .h/.cpp.
2020-03-03 01:23:27 +01:00

44 lines
988 B
Arduino

#ifdef WEBSERVER_DOWNLOAD
// ********************************************************************************
// Web Interface download page
// ********************************************************************************
void handle_download()
{
checkRAM(F("handle_download"));
if (!isLoggedIn()) { return; }
navMenuIndex = MENU_INDEX_TOOLS;
// TXBuffer.startStream();
// sendHeadandTail_stdtemplate();
fs::File dataFile = tryOpenFile(F(FILE_CONFIG), "r");
if (!dataFile) {
return;
}
String str = F("attachment; filename=config_");
str += Settings.Name;
str += "_U";
str += Settings.Unit;
str += F("_Build");
str += BUILD;
str += '_';
if (node_time.systemTimePresent())
{
str += node_time.getDateTimeString('\0', '\0', '\0');
}
str += F(".dat");
web_server.sendHeader(F("Content-Disposition"), str);
web_server.streamFile(dataFile, F("application/octet-stream"));
dataFile.close();
}
#endif // ifdef WEBSERVER_DOWNLOAD