i created one directory using mkdir.now i want to create another directory inside previous directory.

$uploaddir1 = "resumes/".$_SESSION["uss1"]."/".$uname;
echo $uploaddir1;
if(is_dir($uploaddir1))
{ 
echo "Exists!"; 
} 
else
{ 
echo "Doesn't exist" ;
mkdir($uploaddir1,0777);
print "created"; 
}

output is Doesn't existcreated.but when i open $_SESSION["uss1"] directory the new directory was not exist.

Thats strange! check if $uname is empty.

thanks for ur reply.$cname was not exist.i want to know this syntax is correct. $uploaddir1 = "resumes/".$_SESSION["uss1"]."/".$uname; $_SESSION["uss1"]-this is one directory i created already using mkdir.
$uname=this directory i want to create now.

Yep. Its correct. Make sure that none of the variables are empty.

there is no empty variable.i'm getting output is resume/hi/hi1doesn't existcreated.

hmm.. When you execute mkdir, check again if that directory exists. ie.,

mkdir($uploaddir1,0777);
if(is_dir($uploaddir1))
{
echo "Exists!";
}
else
{
echo "Doesn't exist" ;
}

$uploaddir1 = "resumes/".$_SESSION["uss1"]."/".$uname;
echo $uploaddir1;
if(is_dir($uploaddir1))
{ 
echo "Exists!"; 
} 
else
{ 
echo "Doesn't exist" ;
mkdir($uploaddir1,0777);
print "created"; 
}

No.this is my whole coding.for this i'm getting output resumes/hi/hi1doesntexistcreated. i did all the checks.but directory was not created in the site.

No dude. You are checking before creating the directory. Do the same after you create the directory. That way, you will know if it really created the directory or not.

thank you.my code was not creating a directory really..

hmm.. Strange.. It didn't throw any error !

hi
i just view your code so i have a one idea

<?php
$path = dirname( __FILE__ );
$uploaddir1 = $path."resumes/".$_SESSION["uss1"]."/".$uname;
?>

try this b'cos $path give you current directory path
and also make sure that parents directory have right to create child directory

Thanks

Will you people PLEASE read the date on the last post before you bump year old threads, this is getting really, really annoying and it's been happening a lot lately.

Hi,
I have created the folder for using the following code
<?php
define("Folder","year");
$folders = Folder."/".date("Y")."/".strtolower(date("M",strtotime("May")).date("y",strtotime("2011")));
if(!is_dir($folders)){
$dir = explode("/",$folders);
$dir_folder = "";
foreach($dir as $d){
$dir_folder .= $d ."/";
if(!is_dir($dir_folder)){
mkdir($dir_folder,0777);
echo "ok";
}

}
}
else{
echo "no";
}
?>

Output: year/2011/may11

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.