Alright ive got a code to display my directory which has 20 files in.
Is there a way to only display 5 of the files or maybe display 5 random files..
This is the script ive got so far. im having trouble..PHP Code:
<?php
$directory = "./files";
//Directory is set;
$dir = opendir($directory);
//Opened the directory;
while($file = readdir($dir)){
//Loops through all the files/directories in our directory;
if($file!="." && $file != ".." ){
echo '<A href=" ' . $file .' "> ' . $file .' </a> </br>';
}
}
?>
Bookmarks