PHP mkdir() Function - If Folder Exists

forms, php

Solution

You can use is_dir:

<?php 
$path = "QuickLinks/$_POST[contractno]";
if(!is_dir($path)){
  mkdir($path);
}
?>

Problem

I have a PHP Script that creates a folder based on a form. I'm wondering if there is a way to NOt create and replace that folder if it already exists? ``` <?php mkdir("QuickLinks/$_POST[contractno]"); ?> ```

Original source

Related problems