Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading a list of files from a directory 1

Status
Not open for further replies.

farley99

MIS
Joined
Feb 12, 2003
Messages
413
Location
US
I want to read a list of all the images in a directory and display them to the screen dynamically.

something like

foreach ($file in images directory){
echo &quot;<img src=$file>&quot;;
}

What is the correct syntax for this?
 
This is what I use:
[tt]$dirHandle = opendir(&quot;./images&quot;);
while ($image = readdir($dirHandle))
{
if ($image == '.' || $image == '..')
continue;
echo '<img src=&quot;/images/' . $image . '&quot; alt=&quot;' . $image . '&quot; /><br />';
}
closedir($dirHandle);[/tt]

//Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top