define('SITE_ROOT', realpath(dirname(__FILE__))); $file_path_exel = (SITE_ROOT . "/temp/" . $this->client['id'] . ".xlsx"); if (file_exists($file_path_exel)) { echo "i'm found!"; } 

The file is not located. I tried to work with a variable differently and without SITE_ROOT ("/temp/" . $this->client['id'] . ".xlsx" and "temp/" . $this->client['id'] . ".xlsx") , but without success.

File uploaded and moved from folder.

  • one
    At least you said what comes in the SITE_ROOT constant, and how it sees the line (SITE_ROOT. "/ Temp /".$ this-> client ['id'].". Xlsx ") - Denis Kotlyarov
  • Print the contents of the $ file_path_exel variable to the browser in order to understand where the code is trying to check the file. - Visman
  • @DenisKotlyarov define ('SITE_ROOT', realpath (dirname ( FILE )));
  • I do not know what the joke is, but today everything works, but did not change anything ...... - DarkVss
  • I here see slashes not right, / \ select at least one :) or make a replacement with a slash, I always remember with the Windows server - Denis Kotlyarov

2 answers 2

Of course , the problem is not in the file_exists function, which perfectly sees any files.
And in the path passed to it and / or the real existence of the file along this path.

     $file_path_exel = (SITE_ROOT . DIRECTORY_SEPARATOR."temp" . DIRECTORY_SEPARATOR . $this->client['id'] . ".xlsx");