
September 17th, 2003
05:58 PM
Student, wannabe webdeveloper but spend to much time playing games.
Status: Offline!
File Listing
I was wondering if anyone could tell me how to or make a script that would list a group of files on a webserver.
Heres my senario:
I have a folder on my webserver full of songs and I was just wondering if there were a way I could get a script to read the total number of files and list them in alphabetical order?
Any help here would be greatly appreciated!
___________________
The rising cost of living hasnt affected its popularity.
Last edited by WaffleX, September 17th, 2003 06:02 PM (Edited 1 times)

September 17th, 2003
07:00 PM
Graphics and web designer
Status: Offline!
have a look at the sticky mate on the main php forum ..
the last tutorial that was added is what u need ..
Have a good read of it and see what u come up with ..
Hope that helps a little bit ..
Phil
___________________
--PowerDesignz--
FreeLance WebDeveloper
--Back from the Dead--

September 17th, 2003
09:18 PM
Neverside Newbie
Status: Offline!
I have one already made www.motorspin.com/lister.php
if you like tell me and I'll give you the file.
___________________
Travis Farrell


October 4th, 2003
11:49 PM
Designer
Status: Offline!
Here's one i made myself, my very first file lister, and it also has a build in uploader so guests can upload stuff, but you can remove that if you want, it also has a really cool stylesheet, enjoy !! 
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #242424;
}
body,td,th {
color: #CCCCCC;
font-family: Tahoma;
font-size: 9px;
}
a {
font-size: 9px;
color: #00CCFF;
}
a:visited {
color: #00CCFF;
text-decoration: none;
}
a:hover {
color: #00CCFF;
text-decoration: underline;
}
a:active {
color: #00CCFF;
text-decoration: none;
}
a:link {
text-decoration: none;
}
-->
</style>
<? $maindir = "" ;
$mydir = opendir($maindir);
$exclude = array("index.php", "index.html");
while($fn = readdir($mydir)) {
if ($fn == $exclude[0] || $fn == $exclude[1]) continue;
echo "<br><a href='$fn'>$fn</a>"; } closedir($mydir);
?>
<p>
Upload a file:
<?php
if(!isset($_POST['submit']))
{
print("<form enctype=\"multipart/form-data\" method=\"post\">
<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"10000000\">
Select a file to upload:
<input name=\"userfile\" type=\"file\">
<input name=\"submit\" type=\"submit\" value=\"Upload!\">
</form>");
}
else
{
$upfiledest = "C:\\Program Files\\Apache Group\\Apache\htdocs\\ftp\\".$_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $upfiledest))
{
print "File is valid, and was successfully uploaded.";
}
else
{
print "File upload unsuccessful:\n";
print_r($_FILES);
}
}
?>

October 10th, 2003
02:35 AM
Neverside Newbie
Status: Offline!