Solved

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

Posted on 2011-02-12
1
371 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
1 Comment
 
LVL 38

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

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.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to dynamically set the form action using jQuery.

785 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