I am trying to read a file from a directory 2 folders lower than the script. The code works fine when the file is in the same directory but when its lower, it fails every time.
Here’s My code
<?php
$logfile = '/pass/uploads/test.aes';
$my_file = file_get_contents("$logfile");
echo $my_file;
?>
Ideas?
A filename beginning with
/is an absolute name, and is relative to the root of the filesystem.Remove the beginning slash if it’s meant to be a name relative to the current directory. Or, tack
__DIR__onto the beginning of the name, like__DIR__ . '/pass/uploads/test.aes'.