SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru team1504's Avatar
    Join Date
    May 2010
    Location
    Okemos, Michigan, USA
    Posts
    732
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question File not echo-ing what it should be

    Hello,
    So the following is a script that should echo the name of the files in the directory http://www.the-irf.com/ , but when I run the script of my server here (http://www.the-irf.com/echoFile.php) all I see is a blank page.

    Does anyone know why this is occurring and how to fix it?

    PHP Code:
    <?php
    $dir 
    "http://www.the-irf.com/files/";

    // Open a known directory, and proceed to read its contents
    if (is_dir($dir)) {
        if (
    $dh opendir($dir)) {
            while ((
    $file readdir($dh)) !== false) {
                echo 
    "filename: $file";
            }
            
    closedir($dh);
        }
    }
    ?>
    I would appreciate any and all help!

    Thanks in Advance & Best Regards,
    Team

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2004
    Location
    Michigan
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Guru team1504's Avatar
    Join Date
    May 2010
    Location
    Okemos, Michigan, USA
    Posts
    732
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by litebearer View Post
    That is another way to do something similar, but I am trying to echo the names of the files not the paths to them.

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    $dir = "http://www.the-irf.com/files/";

    SB

    $dir = "/path/on/your/server/websites/irf.com/files/";

    OR a path relative to the folder this script is called from:

    $dir = "../files/";

    OR same folder:

    $dir = "./";

  5. #5
    SitePoint Guru team1504's Avatar
    Join Date
    May 2010
    Location
    Okemos, Michigan, USA
    Posts
    732
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    ah, so i can't use a url then?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •