Nobert
Nobert

Reputation: 163

How can you get all the files in a folder - javascript

I'm making a website and i want to see how many projects were submitted by the users and they are all in a folder. There are a lot of questions on the same topic just that they are on node.js. Is there a way to get the files in a way so i can do a foreach loop and get there directories?

Upvotes: 0

Views: 195

Answers (1)

Andrea Giammarchi
Andrea Giammarchi

Reputation: 3198

The client side cannot crawl the server, for obvious security reasons, unless the server provides such utility, either as end point that lists all its folders, or as a pre-generated folders.json file you can then read from the client.

This is why every other solution mentions Node.js, PHP, Python, or whatever, as unless you create and update such file each time, there's no other way.

Upvotes: 1

Related Questions