You need to open the file in IIS. This code opens without problems

$filename = 'C:/web/files/test.txt''; file_get_content($filename); 

But this code causes an error:

 $filename = $_SERVER['DOCUMENT_ROOT'] . '/files/test.txt'; file_get_content($filename); Warning: file_get_contents(C:\web/files/test.txt): failed to open stream: No such file or directory in 

I tried this option:

 $filename = addslashes($_SERVER['DOCUMENT_ROOT'] . '\\files\\test.txt'); file_get_content($filename); 

But also a mistake.

How to open this file in IIS?
Windows Server 2008 R2
PHP 5.6

  • And in Warning exactly teXt.txt is written? - Visman
  • This is already my typo. Everywhere test.txt. I just replaced the real file name with test.txt for easier reading - Alma Z
  • Instead of slashes / backslashes, try the constant DIRECTORY_SEPARATOR php.net/manual/ru/dir.constants.php - Visman

0