-->
Page 2 of 2

Re: ESP8266 Code to list SPIFFS Files as URL on web --Solve

PostPosted: Sun Jan 16, 2022 8:44 pm
by Sirquil
@ GaryRH Thank you for your request.

You will need four components to list files as URL links:

1.AsyncWebServer https://github.com/me-no-dev/ESPAsyncWebServer
2. AsyncWebServer request
3. AsyncWebServer Processor
4. Web page stored in memory

Code: CameraRainGage

Image

Processing of the “File Reader” web page by AsyncWebServer:

Main Menu selection, “File Reader” request loads HTML2 (“index2.h”) web page by “Processor2”; which creates the list of filenames as URL links. Function “String notFound(AsyncWebServerRequest *request)” code by Pablo2048 of “Github.com” processes selected URL filename link into a SPIFFS, filename and returning the filename (“fn”). Request->redirect("/Show"); loads HTML6 (“index6.h”) web page by “Processor6”. HTML6 has embedded Jason Script from Sara Santos of “Random Nerds Tutorials”; which “GETS” request “/get-file” to display contents of the selected “File Reader” filename. HTML6 adds web page title, header and links; to return to “File Reader” and “Main Menu” links.

Contents of a file from “File Reader”:

Image

William