Web Analytics Made Easy -
StatCounter checking if file exists error... - CodingForum

Announcement

Collapse
No announcement yet.

checking if file exists error...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • checking if file exists error...

    if (is_file("/forum/php/index.php"))


    its going to else which means its returning the file doesnt exist and it does....the script works when the file being checked is in the same directory as script....whats wrong?
    ~Designer's Toolz~

  • #2
    try using "file_exists" instead of "is_file"

    -Celt

    Comment


    • #3
      i figured it out. I wasnt going back far enough. Browsers only require you to go to the main folder for the www/html files. However I found PHP has no way of knowing what the top level is....while /forum/php/index.php is a fine relative file path for browsers.....php needs to start all the way from the root directory...which was something like var/www/html/forum/php/index.php.....thanks anyways
      ~Designer's Toolz~

      Comment


      • #4
        To sort that out, don't use the first forward slash. / means from root

        Comment


        • #5
          And you can also use the dot to signify you want to start in the current directory. That would make looking for the file "relative" instead of absolute. Such as:

          "./folder/folder/file.php"

          Comment

          Working...
          X