Solved

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

Posted on 2011-02-12
1
369 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now