3
$file_name = "x:/htdocs/host/sales_documents/testvilkår, webhotell og domenenavn_2ccda.pdf";

if(!file_exists($file_name))
{   
    echo "<h2>404 Error</h2>";
    exit;
}

File name is a valid file and also it really exist, but still file_exists is returning false.
Can you tell me what is a reason behind it?

Navnath Godse
  • 2,233
  • 2
  • 23
  • 32
Vikramraj
  • 188
  • 4
  • 18

2 Answers2

1

check your file path. your code is ok.

0

Change slashes to constant DIRECTORY_SEPARATOR and add file:// to path.

kicaj
  • 2,881
  • 5
  • 42
  • 68