file_exists is not work !(php)

491 views Asked by At

this code is correct and returned True

if (file_exists("./up_dir/p57hekl77307hhHkkglkIp/01397678849965301.png")) {
    echo "True";
} else {
    echo "false";
}

but this code returned False !

$dir = $_POST["dir"];   // = p57hekl77307hhHkkglkIp
$name = $_POST["name"]; // = 013976788499653

if (file_exists("./up_dir/" . $dir . "/" . $name . "01.png")) {
    echo "True";
} else {
    echo "false";
}

please help

1

There are 1 answers

1
S.A.R.M On

its work :)

if (file_exists(dirname(__FILE__) . "/up_dir/" . $dir . "/" . $name . "01.png")) {
    echo "True";
} else {
    echo "false";
}

Thank RelaxedArcher for answer and other user for helping me