I've read as many previous posts as I can find and tried all the suggested solutions but the following simple test code will not work for me (the session variable has been echoed and is correct). Instead of echoing the correct answer, the if(file_exists($target_file)) skips the true result and always displays the false one. I've tested it with files that do and don't exist of course. Here is the code:
$filename = $_SESSION["filename"];
$target_file = $_SERVER['CONTEXT_DOCUMENT_ROOT'] . '/folder/' . $_SESSION["filename"];
if (file_exists($target_file)) {
echo 'Selected file is ' . $filename . ' and will be written.';
} else {
echo "Selected file " . $filename . " doesn't exist.";
}
I'd really appreciate some help on this please.