#1
  1. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,960
    Rep Power
    173

    File_exists always returns true even if the file does not exist!


    Hi

    This always returns true no matter what!
    PHP Code:
    if(file_exists('/hsre/loc/home/aaless/domain.au/uploads/'.$row->DID).".jpg"
    I tried this too:
    PHP Code:
    if(file_exists('/uploads/'.$row->DID).".jpg"
    PHP Code:
    if(file_exists('uploads/'.$row->DID).".jpg"
    They all retuns true no matter what.

    How can I tell if the file exists or not?

    Thanks
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1016
    Look at the parentheses, especially the closing ones.

    Yes, that's the beauty of implicit type conversion.

    Comments on this post

    • ManiacDan agrees
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. A Change of Season
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    2,960
    Rep Power
    173
    Originally Posted by Jacques1
    Look at the parentheses, especially the closing ones.
    ,,,,well of course.

IMN logo majestic logo threadwatch logo seochat tools logo