Php Check Folder Exists And Create

[Solved] Php Check Folder Exists And Create | Php - Code Explorer | yomemimo.com
Question : php check folder exists and create

Answered by : akbarali

if (!file_exists('path/to/directory')) { mkdir('path/to/directory', 0777, true);
}

Source : | Last Update : Sun, 09 Jan 22

Question : php check if folder exists

Answered by : encouraging-eagle-257ub9oodfwl

<?php
$filename = '/path/to/foo.txt';
if (file_exists($filename)) {
    echo "The file $filename exists";
} else {
    echo "The file $filename does not exist";
}
?>

Source : https://www.php.net/manual/en/function.file-exists.php | Last Update : Tue, 08 Dec 20

Answers related to php check folder exists and create

Code Explorer Popular Question For Php