how to scan a folder for documents with javascript

Solutions on MaxInterview for how to scan a folder for documents with javascript by the best coders in the world

showing results for - "how to scan a folder for documents with javascript"
Arianna
17 Feb 2018
1var dir = "/videos";
2var fileextension = ".mp4";
3$.ajax({
4    //This will retrieve the contents of the folder if the folder is configured as 'browsable'
5    url: dir,
6    success: function (data) {
7        // List all mp4 file names in the page
8        $(data).find("a:contains(" + fileextension + ")").each(function () {
9            var filename = this.href.replace(window.location.host, "").replace("http:///", "");
10            $("body").append($("<img src=" + dir + filename + "></img>"));
11        });
12    }
13});