Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post

    Post List dir and display txt file

    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 :




    PHP Code:


    <?PHP

    //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($file0, -4);
    include 
    'Comments/$rest.txt';

    }
    //closing the directory
    closedir($dir_handle);

    ?>
    Thanks

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    What was the question?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •