Thank you Barand for your help.
I have write the code again and works, it seems that I forgot to put name='filestoupload[]'. But there is one last problem, the code does not insert for example 1.jpg , 2 .jpg , 3.jpg in the same row, but it creates 3 different rows and I don't want that. Here is my new code :
<?php
include "db.php";
if(!empty($_FILES['filestoUpload']['name'])){
foreach($_FILES['filestoUpload']['name'] as $key => $val){
$name = $_FILES['filestoUpload']['name'][$key];
$tmp_loc = $_FILES['filestoUpload']['tmp_name'][$key];
$size = $_FILES['filestoUpload']['size'];
$type = $_FILES['filestoUpload']['type'];
$fileExt = explode('.', $name);
$fileActExt = strtolower(end($fileExt));
$allowed = ['jpg', 'jpeg', 'png'];
if(in_array($fileActExt, $allowed)){
$query = "INSERT INTO list(images) VALUES ('$name')";
$result = mysqli_query($conn, $query);
} else {
echo "This is not an image";
}
}
}