Showing posts with label make folder. Show all posts
Showing posts with label make folder. Show all posts

Friday, 5 August 2016

PHP Function to Create a Directory in given Path

Simple php function to create directory in given path. This makes creating your directory easy and efficient.

function createFolder($path, $foldername) {
            $filename = $path.'/'.$foldername;
          
            if (!file_exists($filename)) {
                mkdir($path.'/'.$foldername, 0777);
                return true;
                exit;
            } else { return true; }

}

Pass your path in $path variable and the folder name in $foldername variable.