Create a folder if it doesn’t already exist PHP

Create a folder if it doesn’t already exist PHP

July 19, 2020

To create a folder if it doesn’t already exist in PHP use below code

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

Share This Story, Choose Your Platform!

Lets Discuss On Your Store