ouput the contents of a folder for download

From: Date: Mon, 22 Jan 2007 20:25:49 +0000
Subject: ouput the contents of a folder for download
Groups: php.general 
Request: Send a blank email to php-general+get-247570@lists.php.net to get a copy of this message
I want to output the file contents of a folder to a php page and provide a link for them to be downloaded. This is what I have so far but I cannot get a filename or get it to iterate through all the files in a folder. <?php $dir = "mydirectory"; // Open a known directory, and proceed to read its contents if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { echo filetype($file) . "\n"; echo filesize($file); } closedir($dh); } } ?>

« previous php.general (#247570) next »