So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Skeptic
#74493 I'm trying to make a web server that displays a few different web pages, and does a few small things, like sending an IR signal, when a button is pushed on these pages.

The way I knew how to do this was to send large strings to the server using server.send, but that's getting me into trouble because the strings are pretty long (8K chars). Someone told me about SPIFFS, and I'm looking into that now. While I can upload sketch data, I haven't been able to figure out how to "turn on" the uploaded html pages. Can anyone provide a simple sketch that does this, say if I've already uploaded pageone.html?

Also, if I upload pageone.html and my server is running on something like 10.0.0.1, will the page be available at 10.0.0.1/pageone.html?
User avatar
By btidey
#74495 Check out FSBrowser example at

https://github.com/esp8266/Arduino/blob ... rowser.ino

In particular see
Code: Select allserver.onNotFound([](){if(!handleFileRead(server.uri())) server.send(404, "text/plain", "FileNotFound");});



in setup

and the corresponding function which uses
Code: Select all    File file = SPIFFS.open(path, "r");
    size_t sent = server.streamFile(file, contentType);
    file.close();


to return the file contents