Thread: PHP ,directory

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    1
    Rep Power
    0

    PHP ,directory


    why doesnt it shoe any files
    Code:
    <?php
    $dir_name = "./";
    $dir=opendir($dir_name);
    $file_list= "<ul>";
    while($file_name=readdir($dir)){
    if (($file_name !=".") && ($file_name != "..")){
    $file_list .= "<li>$file_name";
    }
    }
    $file_list .= "</ul>";
    closedir($dir);
    ?>
    
    <html>
    <head>
    <title> hmwk#10</title>
    </head>
    <body>
    <p>files in: <? echo "$dir_name"; ?></p>
    <? echo "$file_list"; ?>
    </body>
    </html>
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,965
    Rep Power
    9397
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2011
    Posts
    122
    Rep Power
    0

    The Solutions of your problem.


    Hi friend

    Please find the answer of this question.

    It shows names of files that exist in present directory.

    Thanks
    Diya

    Comments on this post

    • Jacques1 disagrees : Wow, I bet she didn't know *that*
    • ptr2void disagrees : Whatever it take to get more SEO backlinks to a useless body shop in India.

IMN logo majestic logo threadwatch logo seochat tools logo