Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-02-12
1
Medium Priority
?
379 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

719 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