Wednesday, October 28, 2009

List all the files in a directory in php

This code will display all the files in the images folder.


foreach (glob("images/*.*") as $filename) {
       echo basename($filename);
}

3 comments:

  1. I'm started following u ,i'm pleased that u also do the same,Plz follow my blog www.winingdesire.blogspot.com

    ReplyDelete
  2. In this post you have used glob() function? Can you give me a little bit details about that.

    And it would be good if you can explain the each line of code.

    Thanks.

    Shaharia Azam
    http://www.shahariaazam.com

    ReplyDelete
  3. Nice one, didn't known that. How did you come up with this solution?

    ReplyDelete