Solved

cant get opendir & readdir to work ... wheres the problem in my syntax ??

Posted on 2011-02-12
1
374 Views
Last Modified: 2012-08-14
Where am I going wrong ??

here's the folder structure I have now

public_html<
     css<
          files
   images<
        body<
             files
        header<
             files
        icons<
             files
        login<
             files
        user<
             files
     includes<
             files
     scripts<
             files

the php files reside in the "public_html" folder.
here's my code:

<?php

      $dir="/css/";
      
      if (is_dir($dir)) {
          if ($dh = opendir($dir)) {
              while (($file = readdir($dh)) !== false) {
                  echo "filename: $file : filetype: " . filetype($dir . $file) . "\n";
              }
              closedir($dh);
          }
      }
?>
0
Comment
Question by:Imaginx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 39

Accepted Solution

by:
Aaron Tomosky earned 500 total points
ID: 34881386
Php does not use the webroot as it's root folder so /foldername doesn't work. Try ./CSS/
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question