1
$Product_images = $_FILES['product_img'];
foreach($Product_images['name'] as $key => $value) {
$file_name = iSQLsecure($objConnection, $value); // iSQLsecure is my own custom function
$file_name = trim($file_name);
$file_tmp = $Product_images['tmp_name'][$key];
$file_size = $Product_images['size'][$key];
$file_ext = explode('.', $file_name);
$file_ext = strtolower(end($file_ext));
$file_trim_name = rtrim($file_name, ".".$file_ext);
$file_name_new = uniqid($file_trim_name . "-", true) . '.' . $file_ext;
$file_destination = 'img/products/' . $file_name_new;
$image_alt = str_replace("img/products/", "", $file_destination);
move_uploaded_file($file_tmp, "../" . $file_destination);
$query_images = "INSERT INTO images (image_path, image_alt, fk_product_id)
VALUES
('{$file_destination}', '{$image_alt}', '{$new_id}')";
$objConnection->query($query_images) or die($objConnection->error);
}
PHP,하지만 내 생각에, 나는 한 시간보다 $query_images
이상을 실행하지 않아야합니다. 업로드 한 모든 이미지를 반복 할 수있는 방법이 있어야하지만 번만 실행해야합니까?
감사합니다. 오랫동안 코딩하지 않았으므로 모든 것을 기억하기가 어렵습니다. 행복 할 수있는 사람들이 있습니다. 정말로 도움을 주셔서 감사합니다. – Simon
당신은 환영합니다 :) – smozgur