Answers for "php make directory if not exists"

PHP
1

linux php script create directory if doesn't exist

$path = "sample/path/newfolder";
if (!file_exists($path)) {
    mkdir($path, 0777, true);
}
Posted by: Guest on May-27-2021
0

php mkdir if not exists

<?php
if (!file_exists('path/to/directory')) {
  	/**
     * 0755 - Permission
     * true - recursive?
     */
    mkdir('path/to/directory', 0755, true);
}
Posted by: Guest on February-13-2021
4

php mkdir

// Create a directory with the permission level (optional)
<?php
mkdir("/path/to/my/dir", 0700);
?>
Posted by: Guest on April-14-2020

Code answers related to "php make directory if not exists"

Browse Popular Code Answers by Language