mkdir php if not exist code example
Example 1: create folder php
// Create folder if not exist
$folderName = 'images/gallery';
$config['upload_path'] = $folderName;
if(!is_dir($folderName))
{
mkdir($folderName, 0777);
}
Example 2: php mkdir if not exists
<?php
if (!file_exists('path/to/directory')) {
/**
* 0755 - Permission
* true - recursive?
*/
mkdir('path/to/directory', 0755, true);
}