|
 |
|
รบกวนดู code ให้หน่อยคะ ทำ upload file แล้ว file ไม่เข้า folder / ไม่เก็บเข้าdatabase |
|
 |
|
|
 |
 |
|
พอดีว่าทำuploadfile แล้ว file ไม่เข้า folder ที่เรียกให้เก็บและก็ไม่เก็บลง database ให้ด้วยคะ (แต่ก็ไม่แจ้ง error)
เป็นเพราะอะไรหรือคะ ขอบคุณคะ
นี้เป็นหน้าให้ connect กับ database คะ
<?
session_start();
include "config.php";
if (!empty($_POST['id_pro']) AND !empty($_POST['status']) AND !empty($_POST['firstdate_job']) AND !empty($_POST['enddate_job'])) {
$sql = "INSERT INTO tbl_job (ref_id_pro, status, detail, filename1, filename2, firstdate_job, enddate_job,
ref_id_staff) VALUE (
'".$_POST['id_pro']."',
'".$_POST['status']."',
'".$_POST['detail']."',
'".$_POST['filename1']."',
'".$_POST['filename2']."',
'".$_POST['firstdate_job']."',
'".$_POST['enddate_job']."',
'".$_SESSION["username"]."'
) ";
for($i=0;$i<count($_FILES["filUpload"]["name"]);$i++)
{
if($_FILES["filUpload"]["name"][$i] != "")
{
if(copy($_FILES["filUpload"]["tmp_name"][$i],".../mai/attach/".$_FILES["filUpload"]["name"][$i]))
{
//*** Insert Record ***//
$strSQL = "INSERT INTO files ";
$strSQL .="(FilesName) VALUES ('".$_FILES["filUpload"]["name"][$i]."')";
$objQuery = mysql_query($strSQL);
}
}
}
$query = mysql_query($sql) or die ('Error Query ['.$sql.']');
#if($_FILES["filename1"] != '') {
#move_uploaded_file($_FILES["filename1"]["tmp_name"],"".$_FILES["filename1"]["name"]);
#}
/*if(move_uploaded_file($_FILES["filename1"]["tmp_name"],".../mai/attach/".$_FILES["filename1"]["name"])) {
echo 'upload1';
}
if(move_uploaded_file($_FILES["filename2"]["tmp_name"],".../mai/attach/".$_FILES["filename2"]["name"])) {
echo 'upload2';
}
echo 1;
}
else {
echo 0;*/
}
mysql_close();
if(isset($_POST['submit_step_3'])) {
echo"<center>";
?>
<script language="Javascript">
alert ("บันทึกข้อมูลเรียบร้อยแล้ว");
</script>
<script>location.href='detailjob.php'</script>
<?php
echo"</center>";
}
else {
?>
<script language="Javascript">
alert("ไม่สามารถบันทึกข้อมูลได้");
</script>
<script>location.href='detailjob.php'</script>
<? } ?>
<?
ดูให้หน่อยนะคะ ขอบคุณคะ
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2013-07-18 12:26:31 |
By :
zion_vodka |
View :
671 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|
|

|
Load balance : Server 04
|