如何使用php一次将多组图像上传到数据库

I impliment code to upload set of information to database from excel/CSV except image file.

$handle = fopen($_FILES['filename']['tmp_name'], "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
  $data1 = data[0];
  $data2 = data[1];
  $data3 = data[2];

  $sql = "INSERT INTO tblName VALUES ('$data1','$data2','$data2')";
  $conn->query($sql);
}

It may be upload 100 of data to database. How could I upload that amount of images(relevent to the above data) to database.

We only stores the path of the image or file into db. So You have upload to pass the full of your images into the csv in each row. and the first you have to upload the image on your server and then take that path and store it in db. or if the images are already on the server. you can directly save their path.

$handle = fopen($_FILES['filename']['tmp_name'], "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
  $data1 = data[0];
  $data2 = data[1];
  $data3 = data[2];
  $data3 = data[3]; // assuming this the url


  $sql = "INSERT INTO tblName VALUES     ('$data1','$data2','$data2','$data3')";
  $conn->query($sql);
}

You can use LOAD DATA LOCAL INFILE sql query to import csv file

LOAD DATA LOCAL INFILE 'Full path of csv file'
INTO TABLE "table_name"
FIELDS TERMINATED BY ',' ENCLOSED BY '\"'
LINES TERMINATED BY '
'
IGNORE 1 ROWS
(column_1, column_2, column3 ...);