Hallo guys, i am new to php. i would like to create a php page that would allow the contents of a folder (word documents) to be displayed on my web page ready for download. i have one end where the files are uploaded from but this other end is the problem. Please help me out with the code.

Recommended Answers

All 3 Replies

Check directory iterator class. Here is sample code

<?php 
$dirIterator = new DirectoryIterator(dirname(__FILE__));
foreach ($dirIterator as $fileInfo) {
    if($fileInfo->isDot() || !$fileInfo->isFile()) {
        continue;
    }
    echo "<p>".$fileInfo->getFilename() . "</p>";
}

how do i then make each of the files in the directory able for download

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.