01.
<?php
02.
include
"condb.php"
;
03.
if
(isset(
$_POST
[
'uploadImageBtn'
])) {
04.
$uploadFolder
=
'uploads/'
;
05.
foreach
(
$_FILES
[
'imageFile'
][
'tmp_name'
]
as
$key
=>
$image
) {
06.
$imageTmpName
=
$_FILES
[
'imageFile'
][
'tmp_name'
][
$key
];
07.
$imageName
=
$_FILES
[
'imageFile'
][
'name'
][
$key
];
08.
$result
= move_uploaded_file(
$imageTmpName
,
$uploadFolder
.
$imageName
);
09.
10.
11.
$query
=
"INSERT INTO images SET imgName='$imageName' "
;
12.
$ck
= mysqli_num_rows(
$query
);
13.
}
14.
if
(
$ck
>0) {
15.
echo
'<script>alert("Images uploaded successfully !")</script>'
;
16.
echo
'<script>window.location.href="index.php";</script>'
;
17.
}
else
{
echo
"มันไม่ลงฐานข้อมูลโว้ย"
; }
18.
}