01.
if
(
$file_type
==
"application/pdf"
||
$file_type
==
"image/gif"
||
$file_type
==
"image/jpeg"
) {
02.
if
(move_uploaded_file(
$_FILES
[
'name_file'
][
'tmp_name'
],
$targetfolder
)){
03.
$filename
=
$_FILES
[
'name_file'
][
'name'
];
04.
$time
=
date
(
'Y-m-d H:i:s'
);
05.
06.
$sql
="insert into complain(topic,topic_to,name_file,id_user,name_user,position,
07.
dept,subject,detailsub,detail,create_by,create_date,IP_create)
08.
values(
'$_POST[topic]'
,
'$_POST[topic_to]'
,
'$filename'
,
'$_POST[id_user]'
,
'$_POST[name_user]'
,
09.
'$_POST[position]'
,
'$_POST[dept]'
,
'$_POST[subject]'
,
'$_POST[detailsub]'
,
'$_POST[detail]'
,
10.
'$_POST[id_user]'
,
'$time'
,
'$ip'
)";
11.
$query
= odbc_exec(
$link
,
$sql
);
12.
13.
14.
15.
16.
17.
18.
19.
?>
20.
21.
<script>
22.
alert(
'ข้อมูลถูกบันทึกเรียบร้อยแล้ว'
);
23.
24.
25.
</script>
26.
<?php
27.
28.
29.
}
else
{
30.
echo
"Problem uploading file"
;
31.
}
32.
33.
}
else
{
34.
35.
}