bungee Posted January 21, 2009 Share Posted January 21, 2009 Let me start by saying that I know very little about php but I know enough that I like to tinker. I have made a small website to be used locally only at my job to make sorting and finding bookmarks more efficiently. We also have a catalog of pdf files for looking up various stuff that currently are a pain. I finally got some code going that lists them all with their url. There are some directories that are giving me fits though. It seems that it doesn't like the file names of some of the files and instead lists names that aren't there, along with some that are. I have found that some of the 'made up' names are actually in the title. An example. In the directory c:/xampp/htdocs/site/diagrams/mantis there is a file called 7222 sv4b1le.pdf with a title of 400730.TILLER. On the page it shows a file named 400730.pdf which doesn't exist and doesn't show the 7222 sv4b1le.pdf file in the list.;Does php hate pdf files? Am I doing something wrong? Please help. Here is the code. I left it pretty basic until I get it to do what I want. <?php function scandir_recursive($dir) { $items = scandir($dir); foreach($items as $item) { if ($item == '.' || $item == '..') { continue; } $tfile = $dir . '/' . $item; $fname = $item; if (is_dir($item)) { echo "<h1>$item</h1>"; } else if (is_dir($tfile)) { echo "<h1>$item</h1>"; } else { $tfile2 = substr($tfile, 7); echo "<a href='$tfile2'>$fname</a>------http://127.0.0.1$tfile2<br />"; } if (is_dir($tfile)) { scandir_recursive($tfile); } } } scandir_recursive('/htdocs/site'); //scandir_recursive('/htdocs/site/diagrams/mantis'); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.