Forum Moderators: coopster

Message Too Old, No Replies

simple PHP script/file

to show files in the directory

         

nolimit966

9:37 pm on Nov 16, 2004 (gmt 0)

10+ Year Member



Hello

What i want to do is Upload a few files to this main directory (http://example.com/~nintendoadvance/) to let someone access them in a list, and download them files.

how do i do this?
Could it be only configurable by the server itself?
thanks so much!

[edited by: coopster at 9:42 pm (utc) on Nov. 16, 2004]
[edit reason] removed urls per TOS [webmasterworld.com] [/edit]

mincklerstraat

8:33 am on Nov 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Most servers are configured to allow 'directory listings', which is what you want here. Just upload your files to this directory with ftp and people should be able to download them, as long as they're .zip or .tar.gz files, or 'download' files. If they're php files you want shown, just save them with the .txt extension. Then go to the directory and see if they show.

If not, create an index.php and plop the following snippet in it, and upload it to the same directory


<?php
$dir = './';
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh))!== false) {
if($file <> '.' && $file <> '..') echo '<a href="'.$file.'">'.$file.'</a><br />';
}
closedir($dh);
}
}
?>