View Full Version : List dir and display txt file

12-20-2007, 12:41 AM
Good day to you all,
I'm looking into read a directory of image and display the content of a txt file named the same as each image in another directory.

Here the code I'm working with :


//define the path to image as relative
$path = "Test/";

//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");

echo "Directory Listing of $path<br/>";

//running the while loop
while ($file = readdir($dir_handle))
if($file!="." && $file!="..")
$rest = substr($file, 0, -4);
include 'Comments/$rest.txt';

//closing the directory



12-20-2007, 03:51 AM
What was the question?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum