Io per visualizzare il contenuto di una cartella, e per far fare il relativo download dei file interessati uso questa pagina PTF.PHP, che e' nota, messa nella cartella dove vuoi visualizzare i file e le cartelle presenti: (non so se puo' aiutarti)
<?
// Processing variables by "GET" input
$inpath = $_GET['dir'];
$sub = $_GET['sub'];
if (!IsSet($inpath) || ($inpath == ""))
{
$inpath = "";
$directory = ".";
}
else $directory = explode("|",$inpath);
if (!IsSet($sub) || ($sub < 0))
{
$sub = 0;
$directory = ".";
}
?>
Download
<?
// Processing directories
$path = "";
for ($i=0; $i<=$sub; $i++)
{
$folder = chdir($directory[$i]);
$path = $path . $directory[$i] . "|";
if (($directory[$i] != "") and ($directory[$i] != "."))
echo " - <a class=\"navigate\" href=\"ptf.php?dir=". $path . "&sub=".($i+1)."\">" . $directory[$i] . "</a>";
}
echo "\n<hr>\n";
// Getting directory's info...
$folder = opendir(".");
while ($file = ReadDir($folder))
{
$file_array[] = $file;
}
// Processing Files&Directories list element by element
foreach ($file_array as $file) {
if (($file == ".") || ($file == "..") ) continue;
if($file=="ptf.php") continue;
// Checking if it is a directory or a file
if (FileType($file) == dir)
{
if ($inpath != "")
{
$path = $inpath . $file . "|";
$subw = $sub + 1;
}
else
{
$path = $file ."|";
$subw = 1;
}
$listpath[] = " <a class=\"dir\" href=\"ptf.php?dir=".$path."&sub=".$subw."\">".$fi le."</a>
\n";
}
else
{
if ($inpath != "")
$path = str_replace("|","/",$inpath) . $file;
else
$path = $file;
unset($file_array);
$listfiles[] = "<a class=\"file\" href=\"".$path."\" target=\"_new\">".$file."</a>
\n";
}
}
// Printing the list
for ($id=0; $id<count($listpath); $id++) echo $listpath[$id];
for ($id=0; $id<count($listfiles); $id++) echo $listfiles[$id];
// Unsetting all variables
unset($file_array);
unset($file);
unset($folder);
unset($directory);
unset($sub);
unset($subw);
unset($path);
unset($id);
unset($listpath);
unset($listfiles);
?>

Rispondi quotando