Page 1 of 1
auto directory listing
Posted: Wed Aug 03, 2005 1:34 pm
by mkyb14
is there a way with php to make it so that if a php page links to a apache directory with no webpages as in php, html. That php will auto generate a basic page with links to each of the files with in that directory? i'm looking to use a function like this for certain directory's for music files and wanted to know if this was possible so that i'm not trying to code each file to be downloadable!!!!!!....... is this possible with php? if not what other language?
Posted: Wed Aug 03, 2005 1:40 pm
by anjanesh
Create a file in that folder called .htaccess
Enter this in the file
I think this should do but someone more experienced in htaccess can fix this.
no code?
Posted: Wed Aug 03, 2005 1:57 pm
by mkyb14
is there no code then. just the file (.htaccess) ... no php page to call the files...?
Posted: Wed Aug 03, 2005 2:05 pm
by anjanesh
Thats correct - Apache will automatically list the files for you.
does that already
Posted: Wed Aug 03, 2005 2:25 pm
by mkyb14
does that already, but i was hoping that with some sort of php code that i could have it automatically list it with some html/php etc, instead of apache's default dir listing technique
Posted: Wed Aug 03, 2005 5:12 pm
by josh
You can, but you'd have to place an index.php in each folder you want php to do the work.
Take a look at
http://www.php.net/glob