hi everyone,
i have a problem in my php code.i hope anyone of you can help me in this problem.
i have a problem for image uploading in particular folder.
my code works but this will upload images in root directory called as 'upimg'.
i want to upload images into particular directory(variable name as $dirna).
i m giving you my code.so pls help me.
<?php
if(isset($_SESSION['alnamae']))
{
$alaname = $_SESSION['alnamae'];
}
else
{
header("Location: addimg.php");
}
if(isset($_SESSION['dirna']))
{
$dirna = $_SESSION['dirna'];
//echo $dirna;
}
else
{
header("Location: addimg.php");
}
?>
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head><title>Multiple image upload</title>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<?php
error_reporting(0);
$path = "upimg/" . $dirna . "/";
echo $path;
while(list($key,$value) = each($_FILES['images']['name']))
{
if(!empty($value))
{
$filename = $value;
$filename=str_replace(" ","_",$filename);// Add _ inplace of blank space in file name, you can remove this line
$add = $path."$filename";
//$add = "upimg/$filename";
//echo $_FILES['images']['type'][$key];
// echo "<br>";
copy($_FILES['images']['tmp_name'][$key], $add);
//chmod("$add",0777);
}
}
?>
</body>
</html>