How to determine if a file is missing from my server

Discussion in 'PHP' started by tanyania, Jul 16, 2011.

  1. #1
    When I upload new files, their file name is stored into my database. I have been told that a couple of the file downloads weren't working. Upon further investigation I figured out that the file the person wanted to download was nowhere to be seen in my downloads directory. How can I determine if a file exists in my directory? I assume I can somehow use the location that is stored inside my database (ex: myfile.pdf) and compare that with what's in the folder.
     
    tanyania, Jul 16, 2011 IP
  2. Darkhodge

    Darkhodge Well-Known Member

    Messages:
    2,111
    Likes Received:
    76
    Best Answers:
    1
    Trophy Points:
    185
    #2
    I haven't had to do this but maybe this function would be helpful? file_exists(string $filename).

    There's a simple example if you scroll down the page a bit. :)
     
    Last edited: Jul 16, 2011
    Darkhodge, Jul 16, 2011 IP