$dir = '../public/images/product/';
$min_dir = '../public/images/product/thumbnails/';
if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_FILES['photo'])) {
$photo = $_FILES['photo']['name'];
for ($i = 0; $i < count($photo); $i++){
$new_name_big = rand(0,9999999) . '_' . $photo[$i];
$new_name_min = 'min_' . $new_name_big;
$movefile = move_uploaded_file($_FILES['photo']['tmp_name'][$i], $dir . $new_name_big);
if ($movefile){
$resize = img_resize($dir . $new_name_big, $min_dir . 'min_' . $new_name_big, 200, 200);
//$sql = mysqli_query($conn, "INSERT INTO photos (big_url, small_url) VALUES ('$new_name_big', '$new_name_min')");
//mysqli_close($conn);
echo "<p style='color:green;'>Файл загружен!</p>";
} else {
echo "<p style='color:green;'>Ошибка загрузки!</p>";
};
//exit("<meta http-equiv='refresh' content='0; url = $_SERVER[PHP_SELF]' charset=utf-8>");
}
};