0

this is my directory

D:
|--SMUE
  |--a.pdf
  |--b.pdf
  |--file_1
     |--c.pdf
  |--file_2
     |--d.pdf

and below is my coding

<html>
    <head>
        <link rel="shortcut icon" href="images/search_icon.png">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Retrieval System</title>
        <link href="templatemo_style.css" rel="stylesheet" type="text/css" />
        <script language="javascript" type="text/javascript">

        </script>
    </head>
    <body>
        <?php

          foreach (glob("D:/SMUE/*.pdf") as $filename) 
          {
            echo "$filename <br/>";
          }
        ?>
    </body>
</html>

I have tried this coding for viewing files name under the SMUE directory and it work but it only view filenames for a.pdf and b.pdf only.

How can i view the filenames fro c.pdf and d.pdf file too? is there any solution.?
*i want to view all filenames (that .pdf only) under the SMUE folder

user3487681
  • 149
  • 1
  • 1
  • 9
  • Did you try to look at the notes? Solution is there http://php.net/manual/en/function.glob.php – Cheery Oct 20 '14 at 06:07
  • http://stackoverflow.com/questions/12109042/php-get-file-listing-including-sub-directories – Cyclonecode Oct 20 '14 at 06:09
  • you already have the duplicate, the answers there will help you, actually you could just change the file path – Kevin Oct 20 '14 at 06:16
  • possible duplicate of [PHP- retreiving filenames from a multifolder](http://stackoverflow.com/questions/26457998/php-retreiving-filenames-from-a-multifolder) – Kevin Oct 20 '14 at 06:17
  • thanks.. its help. http://stackoverflow.com/questions/12109042/php-get-file-listing-including-sub-directories – user3487681 Oct 20 '14 at 06:42

0 Answers0