August 2nd, 2018, 10:22 AM
-
Download list of files from server?
Hello,
I only have skin-deep knowledge of JavaScript.
Before bothering with a server-side scripting language, I was wondering if JavaScript could download the list of files located in a directory on the server, and use them to fill a listbox in the browser:

That way, I would just have to enable directory listing in that directory on the server, and only use Javascript.
Thank you.
August 2nd, 2018, 03:46 PM
-
JavaScript does support doing http(s) request, mostly known as AJAX.
You could call an URL with directory listing enabled, and then parse the result (html formatted) with a DOM handler for any links in it.
My recommendation is that you use a proper server side language to provide the file list in a better format for processing - so you don't need to parse a html page.
Whether you call it directly during the page request or through AJAX is all up to you.
August 2nd, 2018, 03:53 PM
-
It would (should) be really easy to make a server-side page that outputs a JSON list of the files. Call that with AJAX and render the list however you want.