Hairyloon wrote:At risk of being the blind leading the blind, I think that's handled by the Webserver library. Serving index.htm is the default thing that they do.
In most web servers (Apache, Nginx, IIS) when the user doesn't put a page on their browser url, the server will look for one or more available default pages. If none of those built-in default files is available, they then show the 404.
I wanted to see what this FSBrowser has to offer and if something more than I already have in my library, it would give me some fresh ideas. However, I couldn't get it to work. Erase flash = "All Flash Contents" and I set my router credentials and tried both SPIFFS and LittleFS and it keeps giving me a "Filesystem init failed!" but it does connect up to my router.
Hairyloon wrote:https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer/examples/FSBrowser
What an excellent bit of example code. Truly outstanding: it does very much what I need it to do, with the things that I want to do looking like they are within reasonably easy grasp.
Upload the code to the chip, and straight away there is a file browser, with the facility to upload files and a text editor: an easily set up website on a chip.
What more could we reasonably expect?
I can think of almost nothing: it would be handy to have the facility to easily download everything all in one, and perhaps that feature is there, but I just have not found it yet.
It is probably desirable to have a password to protect the file manager, but that is perhaps not ideal in example code, and should be easy enough to add.
What I want to do next is to set it up as an access point, and put it down the allotment, to serve as an information exchange point. Possibly I will need to set up a few, on a mesh, in order to cover the whole site, but we can cross that bridge when we come to it.
I don't know what your goals are with FSBrowser... maybe you want to study webserver design or have some highly customized ideas to incorporate... but if you just want a web server might consider using InqPortal. With three lines of code in your Sketch...
#include <InqPortal.h>
InqPortal svr;
void setup()
{
svr.begin("MySoftSSID", NULL, "myRouterSSID", "myRouterPassword");
}
void loop() { }
... you get... On the left is Chrome looking at one of the Admin page's tabs which is the File Manager and is built-in to the ESP8266 server. On the right is Windows File Explorer where the files have been selected and dragged over to the ESP8266 Admin File Manager ready to drop. I don't have password protection on the File Manger either. That's a good idea. I'll put it on my TODO list.
Also, there are hundreds of other benefits and capabilities of the library besides file management.
w/ GUI Admin Client, Drag & Drop File Manager, OTA Built-In, Access Point Manager,
Performance Metrics, Web Socket Comms, App API, All running on ESP8266...
Even usable on ESP-01S --- Please check it out!
https://inqonthat.com/inqportal-the-three-line-promise/
https://InqOnThat.com/inqportal