Helpful Information
 
 
Category: Other
download script

i'm looking for a script or way to list files in a directory as a download list
that must be dynamic so i dont need to edit the html page when i change files in the directory...

any help will be appreciated..
thanks

*bumpity*

I need this also for Serberus (my web server) to save me time

cr3ative

HI

Saw these on the web... maybe it can help:
http://www.broadware.com/lib/menu/script/
http://forums.naesp.org/script/

Uhm, I'm confused by those links..

cr3ative

From what I understand, it's the files for a directory listing script. Have not tried it, got it from a friend.

Apparently Apache Tomcat is a servlet that you need to install on your server. I don't think its primary use is directory listing and I guess those scripts are ones automatically generated for use by it.
(Ref: http://jakarta.apache.org/tomcat/)

It could work if you have your own server like cr3ative, but if you want a script instead, or you use a web host which I would assume rlmtech and the majority do, then try this script: (you'll need PHP support - I believe you would have to use a server-side language to do this)


<?php

$dir = ".";

$directories = array();
$files = array();
$dir = (substr($dir, -1) == '/') ? substr($dir, 0, -1) : $dir;
if(is_dir($dir)){
if($handle = opendir($dir)){
while(false !== ($file = readdir($handle))){
if($file != "." && $file != ".."){
if(is_dir($dir.'/'.$file)){
$directories[$file] = filemtime($dir.'/'.$file);
} else {
$files[$file] = filemtime($dir.'/'.$file);
}
}
}
closedir($handle);
} else {
die('Could not open directory.');
}
} else {
die('Invalid directory.');
}

if($_GET['sort'] == 'alpha'){
if($_GET['mode'] == 'desc'){
krsort($files);
$highlight = 'alpha_desc';
} else {
ksort($files);
$highlight = 'alpha_asc';
}
} else {
if($_GET['mode'] == 'asc'){
asort($files, SORT_NUMERIC);
$highlight = 'date_asc';
} else {
arsort($files, SORT_NUMERIC);
$highlight = 'date_desc';
}
}
$sort_alpha_asc = ($highlight == 'alpha_asc') ? '<b>Asc</b>' : '<a href="?sort=alpha&mode=asc">Asc</a>';
$sort_alpha_desc = ($highlight == 'alpha_desc') ? '<b>Desc</b>' : '<a href="?sort=alpha&mode=desc">Desc</a>';
$sort_date_asc = ($highlight == 'date_asc') ? '<b>Asc</b>' : '<a href="?sort=date&mode=asc">Asc</a>';
$sort_date_desc = ($highlight == 'date_desc') ? '<b>Desc</b>' : '<a href="?sort=date&mode=desc">Desc</a>';
echo "Sort by: Date- $sort_date_asc | $sort_date_desc; Name- $sort_alpha_asc | $sort_alpha_desc<br />\n<br />\n";

echo "<table border=\"0\">\n<tr><td><u>File</u></td><td width=\"25\"></td><td><u>Size</u></td><td width=\"25\"></td><td><u>Last Modified</u></td></tr>\n";
foreach($files as $file => $timestamp){
echo "<tr><td><a href=\"$dir/$file\">$file</a></td><td></td><td>";
$filesize = filesize($dir.'/'.$file);
if($filesize >= 1048576){
echo round($filesize / 1048576, 1).'MB';
} else {
echo round($filesize / 1024, 1).'kb';
}
echo '</td><td></td><td>'.date('M d Y H:i:s', $timestamp)."</td></tr>\n";
}
echo '</table>';

?>It will list all the files in the directory specified in the $dir variable, along with their file size and date last modified. You can also sort by the name/date.

It won't list sub-directories in case you, for some reason, use these in your website and don't want people poking around in them. You might be able to see it does store them in an array ($directories) so if they are extra download folders, you can do something with it (if you want the script to work with these you'll need a slight mod).

nice script.

were would you add the subdirectory view?

and is there a way to hide the htasses file?

Try this.

http://evoluted.net/archives/2005/08/directory_listi_2.php

Apparently Apache Tomcat is a servlet that you need to install on your server.Apache Tomcat is a servlet container, and has little or nothing to do with the question at hand.
and is there a way to hide the htasses file?Files beginning with . are not returned by readdir().

Try this.

http://evoluted.net/archives/2005/08/directory_listi_2.php

i have it running ,but it is not exacly what im looking for

see.

i have a ringtone site and there is lots on my server so i want to make it user freindly for me..

i just want a script that will show the content but at the same time be able to play the song and download it..

i think im dreaming ah?lol

The simple solution come when you realize you don't want any graphics or inclusions.

If you can deal with this page being completely blank except for your links to listen/download name all of your files something recognizable, then remove the index page from the folder.

Every file will be listed on the page, left click to view/listen right click to save as...

ORRRR if you are more graphically involved.. there is freeware php programs for directory listsings:

Like THIS one (http://schwarzschmid.de/php-directory-listing/)

~BLiZZ

thx i will try it out.










privacy (GDPR)