我想在一行中上传多个图像,但它创建了两行,一个正是我想要的,另一个是空的。为什么它会创建两行?
<?php
$dir="img";
$imgList = array();
$files_count=count($_FILES['files']['name']);
for($i=0;$i<$files_count;$i++){
if(!empty($_FILES['files']['name'][$i]))
{
move_uploaded_file($_FILES['files']['tmp_name'][$i],$dir."/".$_FILES['files']['name'][$i]);
$file_name = $_FILES['files']['name'][$i];
array_push($imgList,$file_name);
}
}
$imgs = implode(",",$imgList);
mysqli_query($connect,"insert into episodes (Id,images) values ('','$imgs')");
?>