I wrote the code above and is not working, miss something? [closed]

i want to check if the files exits if no make a new file to put what i want

//check if folders exists before save
if(!is_dir($pathFilename)){
    $testPath = $UPLOAD_DIR.$ano;
    if(!is_dir($testPath)) mkdir($testPath);
    $testPath = $testPath.'/'.$mes;
    if(!is_dir($testPath)) mkdir($testPath);
    $testPath = $testPath.'/'.$dia;
    if(!is_dir($testPath)) mkdir($testPath);
}