I have a fragment of code that makes the upload of files, in this case images to the server and then saves the record in the database [MySQL], the operation works but sometimes I find it slow when trying to upload 2 or 3 images, which seems strange to me that result, I share the code that I have to see if you can give me any suggestions, Thanks in advance.
if(isset($_FILES['image']['tmp_name'])){
#Numero de archivos a cargar
$num_files = count($_FILES['image']['tmp_name']);
for($i=0; $i < $num_files;$i++)
{
#Ver si hay archivos para subir
if(!is_uploaded_file($_FILES['image']['tmp_name'][$i]))
{
echo "No se encontraron archivos";
}
else
{
#Copiar imagenes a la carpeta correspondiente de acuerdo a la marca
if(@copy($_FILES['image']['tmp_name'][$i],"$archivo".$_FILES['image']['name'][$i])){
$path = "".$_FILES['image']['name'][$i];
$query3= $con->query("INSERT INTO archivoticket(FK_idTicket, archivoTicket) VALUES('$idTick', '$path')");
}
else
{
echo "No se pudo subir el archivo";
}
}
}
}