Reputation: 145
I'm trying to upload multiple files with for each loop. what should I use in the first parameter of move_uploaded_file() function in this case
foreach ($_FILES["prodImg"]["name"] as $pImage) {
$nbr++;
$col = 'image' . $nbr;
$fileName = basename($pImage);
$target_file = $target_dir . "" . $fileName;
$rqt = "UPDATE prodimages SET $col=? WHERE prodId= ? ";
$stmt = $con->prepare($rqt);
$stmt->execute(array($fileName, $pID));
move_uploaded_file($pImage, $target_file);
}
Upvotes: 0
Views: 3020