Add a list of videos each one in a different button in a web page

Joined
Dec 10, 2022
Messages
1
Reaction score
0
I want to create a list of buttons each one bring the user on a different video, the videos are in the same folder of the index.php, in my hard disk, and my goal would be add each video in a new button. Like for each video in folder/videos I need to create a button with <a href=video1.mp4><button>Video1</button></a>, the same for video2.mp4 video3 and so on.

I don't even know where to start.
 
Joined
Dec 10, 2022
Messages
73
Reaction score
22
Have a look at php docs on scandir. It will get you all the files in a directory. You can exclude files not wanted with if statements.

for javascript could do something like

JavaScript:
var fs = require('fs');
var files = fs.readdirSync('path/to/files');
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,757
Messages
2,569,543
Members
45,026
Latest member
camilin05

Latest Threads

Top