All pastes #618997 Raw Edit

Something

public text v1 · immutable
·published 2007-07-14 10:58 UTC
rendered paste body
<?php

include("download.php");

// This is the directory to list files for.
$theDirectory            = "./upload";
// Do you want to show directories? change to false to hide directories.
$listDirectories    = false;


if(is_dir($theDirectory))
{



echo "<table bordercolor=black border=1 align=center width=640 cellspacing=0 cellpadding=0>";
echo "<tr>";
echo "<td class=tablex width=315 align=center>Filename</td><td class=tablex width=55 align=center>Type</td><td class=tablex width=90 align=center>Size</td><td class=tablex width=105 align=center>Downloads</td>";
echo "<tr>";
echo "<td class=main valign=top colspan=4>";

echo "<table align=center width=95% cellpadding=0 cellspacing=0 border=0>";
echo "<br>";


    $dir = opendir($theDirectory);
    while(false !== ($file = readdir($dir)))
    {
        $type    = filetype($theDirectory ."/". $file);
        $size    = filesize($theDirectory ."/". $file);
        if($listDirectories || $type != "dir")
        {
	    $total = "location.href='/download.php?file=" . $file . "';";
            echo "<tr onMouseover=highlight2(this) onMouseout=revert2(this) style=cursor:pointer; onClick=".$total."><td>";

            echo $file . "</td>";
            echo "<td width=59>" . $type . "</td>";
            echo "<td width=100>" . round($size / 1024,2) . "Kb</td>";
            echo "<td width=100>" . showCount($file) . "</td>";
            echo "</td></tr>";
        }
    }
    closedir($dir);
    echo "</table><br>";
}
else
{
    echo $theDirectory . " is not a directory";
}

?>