1// Create folder if not exist
2 $folderName = 'images/gallery';
3 $config['upload_path'] = $folderName;
4 if(!is_dir($folderName))
5 {
6 mkdir($folderName, 0777);
7 }
1<?php
2if (!file_exists('path/to/directory')) {
3 /**
4 * 0755 - Permission
5 * true - recursive?
6 */
7 mkdir('path/to/directory', 0755, true);
8}