Solved

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

Posted on 2011-02-12
1
372 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 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

831 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