my current folder path is $path = car_images;
Its working for me. i can upload my images into this folder directly.
But i want to create separate folders for each user. so now images should be upload into $path = car_images/$emp_code;
means i want to first create directory with name $emp_code into car_images folder and then into $emp_code directory images will upload.
My current code that's not creating directory into car_images folder.
$path = "car_images/".$emp_code;
if (!is_dir($path.'/'.$emp_code))
{
mkdir($path.'/'.$emp_code, 0777, true);
}
$name = $_FILES['car_images']['name'][$i];
$size = $_FILES['car_images']['size'][$i];
list($txt, $ext) = explode(".", $name);
$file= time().substr(str_replace(" ", "_", $txt), 0);
$info = pathinfo($file);
$filename = $file.".".$ext;
if(move_uploaded_file($_FILES['car_images']['tmp_name'][$i], $path.$filename))
{
$file_name_all.=$filename.",";
}
mkdirgive an warning, or are there any errors? Also i'd use$info['extension']rather than the$ext.$emp_codeset?