You can check whether the folder is exits or not by using file_exists(). You can also create folder by using mkdir(). See below example code to create folder if it doesn’t already exits in PHP.

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

Have any doubt, then comment here!

Leave a Reply

Your email address will not be published. Required fields are marked *