0

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.

5
Contributors
12
Replies
13
Views
9 Years
Discussion Span
Last Post by pandikamal
0

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.

0

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

0

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" ;
}

0
$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.

0

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.

0

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

0

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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.