I would like to have a web based fileserver.
I have a unknown number of files and folders stored at the SD-card.
When the initial “index.html” is requested, the Spider responds with a list of the files and folders in the root.
So far no problems.
The folders are sent as hyperlinks, so the webclient can click on them.
But to browse through the files and folders, for each of them, A WebEvent is required.
This is where I get stuck.
Because the content of the SD-card changes, it is not possible to program all those webEvents.
So I need a Array or List of webevents, but the number is unknown.
Or I need a way to bypass path-specific webEvent, so there is only 1 event. In that case I can determine the current path/url in the eventHandler and respond with the corresponding files and folder.
Please provide me with a example, or any other help. Of course an alternative solution is also very welcome!
It sounds like you need a “Folder.html” page as well as your Index.html page.
Here is a simple overview of how it would work:
When a client clicks on a folder link in your Index page, they would be redirected to the Folder page.
The Folder page would be similar to the Index page, but would include an “Up” link to return to the previous view (of the parent folder).
Each folder link would include querystring parameters that include:
[ul]FullPath of the folder the link represents
ParentFullPath of the folder’s parent folder[/ul]
On your “server” you would use the FullPath value to create the folder contents list, and the ParentFullPath to create the “Up” link.
Of course there are many details that need to be filled in, but this should get you started.
EDIT: Actually thinking about this a little more… you probably can do all this with just your Index page.
Thanks for the quick respond. I have tried google, (of course) but the examples I found were for webservers which don’t require events. When they are addressed like: 192.168.2.200:FolderName/FileName.txt, the server throws the file, or the ‘file not found page’. But that is the part which is not working for my Spider. So that is why I ended up here.
The problem is already the redirecting to the Folder page.
When the clients click the folder, the url changes to: http://192.168.2.200/folder1/
And the server will seek such webEvent, which does not exists. So the webserver throws the ‘index’ event.
As you already mentioned in your edit. I only need the index event!