#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    51
    Rep Power
    15
    I am writing a script that will insert a link to the page, but before it does that, it must check to see if the page exists. I can use the file_exists($page_file) function, but it seems to only work if the file is in the same directory where the script executes. My script is supposed to find the script in another directory, but it does not find them and returns false. Does anyone know how to solve this problem?

    ------------------

    Yanik!
    Edmonton, AB
  2. #2
  3. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    Location
    London, UK
    Posts
    2,019
    Rep Power
    17
    This might sound incredibly obvious, but did you try specifying the full path to the file?

    file_exists("/home/user/www/the_directory/");

    Hope this helps,

    --------------------------------------------
    Alex
    (http://www.alex-greg.co.uk)
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    51
    Rep Power
    15
    Actually, I figured it out, I was doing the right thing the whole time, it was just that it does not recognize another file in the hard drive only if it's in another directory. However, if it is in the same directory then it does work. So I just put the script on the server and it worked! So basically, I did not change anything. COOL!

Similar Threads

  1. Replies: 1
    Last Post: February 11th, 2004, 08:47 PM
  2. Replies: 1
    Last Post: February 8th, 2004, 02:59 PM
  3. PHP file upload script trouble
    By casbboy in forum PHP Development
    Replies: 9
    Last Post: February 5th, 2004, 08:42 PM
  4. check file exist
    By queryguy in forum PHP Development
    Replies: 1
    Last Post: February 3rd, 2004, 09:12 AM
  5. fopen (no such file or directory) ERROR!
    By GASCAN in forum PHP Development
    Replies: 1
    Last Post: January 28th, 2004, 07:31 AM

IMN logo majestic logo threadwatch logo seochat tools logo