-->
Page 2 of 3

Re: FSBrowser

PostPosted: Thu Apr 14, 2022 6:56 am
by Inq720
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...

Code: Select all#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.
Untitled.png

Re: FSBrowser

PostPosted: Thu Apr 14, 2022 1:57 pm
by Hairyloon
Inq720 wrote:
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.

I think you have to upload a filesystem image or something. Do you have the LittleFS Tool?
What flash size settings are you using?
And what are you using to programme it?

Re: FSBrowser

PostPosted: Thu Apr 14, 2022 2:07 pm
by Hairyloon
By strange coincidence, a note about these tutorials just dropped into my inbox. I haven't looked at them, but I have found the site generally helpful.

https://randomnerdtutorials.com/install ... duino-ide/
https://randomnerdtutorials.com/install ... s-arduino/

Re: FSBrowser

PostPosted: Thu Apr 14, 2022 2:22 pm
by Inq720
Hairyloon wrote:I think you have to upload a filesystem image or something. Do you have the LittleFS Tool?
What flash size settings are you using?
And what are you using to programme it?


I used to use both SPIFFS and LittleFS extensively before doing my own. I always remembered it having to initialize (which is basically the same as formatting the disk) first then you can use the corresponding tool and upload files that are in a data folder. The error I'm receiving is saying its failing that initialization.

I'm using the Arduino IDE on a NodeMCU, using the: 4MB (FS:3MB OTA: ~512KB)

It was more curiosity... to see what you liked about it. See if there was any benefit.
Thanks.