diff --git a/example-02/webpages.h b/example-02/webpages.h index a7dae15..f471a36 100644 --- a/example-02/webpages.h +++ b/example-02/webpages.h @@ -26,7 +26,7 @@ function logoutButton() { setTimeout(function(){ window.open("/logged-out","_self"); }, 1000); } function rebootButton() { - document.getElementById("statusdetails").innerHTML = "Invoking Reboot ..."; + document.getElementById("details").innerHTML = "Invoking Reboot ..."; var xhr = new XMLHttpRequest(); xhr.open("GET", "/reboot", true); xhr.send(); diff --git a/example-02/webserver.ino b/example-02/webserver.ino index 2b3544e..be6b426 100644 --- a/example-02/webserver.ino +++ b/example-02/webserver.ino @@ -96,17 +96,17 @@ void configureWebServer() { logmessage = "Client:" + request->client()->remoteIP().toString() + " " + request->url() + "?name=" + String(fileName) + "&action=" + String(fileAction); - if (!SPIFFS.exists(fileName)) { + if (!SPIFFS.exists(String('/') + fileName)) { Serial.println(logmessage + " ERROR: file does not exist"); request->send(400, "text/plain", "ERROR: file does not exist"); } else { Serial.println(logmessage + " file exists"); if (strcmp(fileAction, "download") == 0) { logmessage += " downloaded"; - request->send(SPIFFS, fileName, "application/octet-stream"); + request->send(SPIFFS, String('/') + fileName, "application/octet-stream"); } else if (strcmp(fileAction, "delete") == 0) { logmessage += " deleted"; - SPIFFS.remove(fileName); + SPIFFS.remove(String('/') + fileName); request->send(200, "text/plain", "Deleted File: " + String(fileName)); } else { logmessage += " ERROR: invalid action param supplied";