Vikramraj
Vikramraj

Reputation: 198

php's file_exists is returning false for file name having foreign language characters

$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?

Upvotes: 3

Views: 196

Answers (2)

kicaj
kicaj

Reputation: 2968

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

Upvotes: 0

Meghendra S Yadav
Meghendra S Yadav

Reputation: 134

check your file path. your code is ok.

Upvotes: 1

Related Questions