Get all file in folder javascript
My website is serving a lot of pictures from Show asked Jul 7, 2015 at 16:27
7
The current code will give a list of all files in a folder, assuming it's on the server side you want to list all files:
answered Jul 7, 2015 at 16:32
9
No, Javascript doesn't have access to the filesystem. Server side Javascript is a whole different story but I guess you don't mean that. answered Jul 7, 2015 at 16:35
Simpal KumarSimpal Kumar 3,9014 gold badges27 silver badges48 bronze badges 4 I write a file dir.php
In your script add:
and use the files[] array answered Dec 27, 2017 at 10:42
IfThenElseIfThenElse 4675 silver badges13 bronze badges 5 For client side files, you cannot get a list of files in a user's local directory. If the user has provided uploaded files, you can access them via their
answered Jun 19, 2017 at 13:16
NaltrocNaltroc 9641 gold badge14 silver badges34 bronze badges For getting the list of filenames in a specified folder, you can use:
This will return a list which you can parse by simple list indexing like
double-beep 4,58613 gold badges30 silver badges40 bronze badges answered Mar 5, 2019 at 17:39
2 I made a different route for every file in a particular directory. Therefore, going to that path meant opening that file.
I called this function passing the list of filename in the directory answered Oct 13, 2019 at 19:25
I use the following (stripped-down code) in Firefox 69.0 (on Ubuntu) to read a directory and show the image as part of a digital photo frame. The page is made in HTML, CSS, and JavaScript, and it is located on the same machine where I run the browser. The images are located on the same machine as well, so there is no viewing from "outside".
|