file_exists can not find file

1

I have a problem when using the php function that checks if a file exists in a directory using file_exists but always returns false even if the file is in the directory someone would have a solution for that

$filename = 'http://megaki/uploads/windows/thumb.jpg';
     if (file_exists($filename)) {
         echo 'O arquivo existe no diretorio.';
          } else {
           echo 'O arquivo não existe nesse diretorio.';
              }

remembering the image exists in the windows directory more when running returns the message from the else that the file can not be found I am using local server wampserver

    
asked by anonymous 14.10.2017 / 18:08

1 answer

2

You Can Use Magic Constant

__DIR__

(Returns the path to the php file in which it is inserted) and scroll to the path of the requested file. Example:

file_exists(__DIR__.'/caminho/para/o/arquivo');
    
14.10.2017 / 18:29