Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By Hairyloon
#87730 https://github.com/esp8266/Arduino/tree ... /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.
User avatar
By CouchPotato
#94251 I am new at this, so please pardon if this is a basic question. I have looked through the fsbrowser code several times and can not understand exactly what makes the program serve index.htm from the littlefs file system. Can anyone help me with this?

I understand making an html page in program memory and sending it to a browser but again what in the fsbrowser code gets the program to send index.htm from the littlefs file system.
User avatar
By Hairyloon
#94278
CouchPotato wrote:I am new at this, so please pardon if this is a basic question. I have looked through the fsbrowser code several times and can not understand exactly what makes the program serve index.htm from the littlefs file system. Can anyone help me with this?


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.
User avatar
By btidey
#94286 In the function handleFileRead(String path)

there is the line

if(path.endsWith("/")) path += "index.htm";

So if you call with url with no file specified then it defaults to index.htm