I am developing a system that needs to raise 2 types of img
a small and a large one for the database, but when I send up 3 img
small and 3 img
big test my foreach
does not go up all I do not know what to do, but I do not know what to do with it.
Code:
require"conexao.php";
if(isset($_POST['port'])){
//dados que serão incluidos
$nome = $_POST['galeria'];
foreach($_FILES['imgp']['tmp_name'] as $key => $name_temp){
$name = $_FILES['imgp']['name'] [$key];
$tmpnm = $_FILES['imgp']['tmp_name'][$key];
$type = $_FILES['imgp']['type'][$key];
$size = $_FILES['imgp']['size'][$key];
$dir = "../images/small/portfolio/".$name;
$mover = move_uploaded_file($tmpnm , $dir);
foreach($_FILES['imgb']['tmp_name'] as $k => $n){
$nomev = $_FILES['imgb']['name'] [$k];
$t = $_FILES['imgb'] ['tmp_name'] [$k];
$tipo = $_FILES['imgb']['type'][$k];
$tam = $_FILES['imgb']['size'][$k];
$dire = "../images/big/portfolio/".$nomev;
$move = move_uploaded_file($t , $dire);
if($mover&&$move){
$sql = mysqli_query($mysqli, "INSERT INTO portfolio(nome, img, type, size, img_big, tipo, tam)
values('$nome', '$name', '$type', '$size', '$nomev', '$tipo', '$tam')") or die (mysqli_error());
if($sql){
echo "foi";
}
else{
echo "erro database";
}
}else{
echo"<h1>Ocorreu um erro.</h1>";
}
}
}
}