Right I had this working on my local server which was windows server 2012, however when hosting I am now on a linux server.
when the user submits the form it should run this code
Code:
$target_dir = "docs". "/";
//IF/ELSE the folder is already created...
if(!file_exists($target_dir . $ref . "/"))
{//Create folder named 1 inside the customer ref folder.
mkdir($target_dir . $ref . "/" . "1" . "/", 0775, true);
$count = 0;
}else
{//Create new folder inside customer ref folder
//count the amount of folders inside docs/$ref/
$find_folders = glob($target_dir . $ref . "/" . "*",GLOB_ONLYDIR);
$count = count($find_folders);
//create new folder inside $ref/ using count+1 to make the folder increase by 1
$new_folder = $count +1;
mkdir($target_dir . $ref . "/" . $new_folder . "/", 0775, true);
}
//IF count exists then the $target_file changes to the new folder...
if($count > 0)
{
$target_file = $target_dir . $ref . "/" . $new_folder . "/";
}else
{//else use first directory
$target_file = $target_dir . $ref . "/" . "1" . "/";
}
On my windows server every single "/" you see i was using DIRECTORY_SEPARATOR but asumed being linux it would need to be changed to a forward slash. This is now not working. Any dieas why?