Im trying to upload photos and info but the photos dont upload can anyone help with this code?
//Add it
if($act == "addnew")
{
//Upload files
if ($_POST['MAX_FILE_SIZE'])
{
$namelist=array(); // we'll hold all the filenames here...
foreach ($_FILES["pic"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pic"]["tmp_name"][$key];
$name = $next_id."_".$_FILES["pic"]["name"][$key];
move_uploaded_file($tmp_name, "$directory$name");
echo $name." Uploaded<br>";
$namelist[]=$name;
}
}
}
$lctn = addslashes($lctn);
$type = addslashes($type);
$vews = addslashes($views);
$insert_names=implode(",", $namelist); // make array a comma-seperated list
mysql_query("INSERT INTO propdb SET ID = '$next_id', lctn = '$lctn', type = '$type', psize = '$psize', lsize = '$lsize', views = '$views', price = '$price', brooms = '$brooms', bhrooms = '$bhrooms', lounges = '$lounges', kitchens = '$kitchens', images = '$insert_names'", $connection);
echo "The entry has been successfully added.";
};
thank you.