SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2006
    Location
    Bulgaria
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Does opendir() work with full/absolute paths? - newbie question

    I have a small function that takes as a parameter url of a folder and returns an array with the names of the files in this folder. It works with relative paths and doesn't seem to work with absolute paths (http://...).

    So I'd like to ask:
    1. Does the opendir() function work with absolute paths? If not...
    2. Does an alternative of the function described above that works with absolute paths exist in PHP? And...
    3. Do you know if such alternative exists in ColdFusion?

    Thank you very much!

  2. #2
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The absolute path is the location of the folder on the server., eg /home/username/public_html and yes it will work with opendir()

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes it works with absolute filesystem paths. a url is not a filesystem path.


    the $_SERVER['DOCUMENT_ROOT'] variable may be helpful to craft an absolute filesystem path. keep in mind though that this variable is not always available in all php installs, although its very common.

  4. #4
    SitePoint Member
    Join Date
    May 2006
    Location
    Bulgaria
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much! Highly appreciate your help!


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
  •