I'm trying to input multiple file names into a database but it only inputs one file name, all the files upload successfully, do i need an array?
if($act == "addnew")
{
//Upload files
if ($_POST['MAX_FILE_SIZE'])
{
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;
}
}
}
$lctn = addslashes($lctn);
$type = addslashes($type);
$vews = addslashes($views);
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 = '$name'", $connection);
echo "The entry has been successfully added.";
};