|
 |
|
เพิ่มรูปภาพใน Chrome ไม่ได้อ่ะ ต้องทำยังไง แต่ใน Firefox ทำได้ |
|
 |
|
|
 |
 |
|
เอา Code มาดูครับ 
|
 |
 |
 |
 |
Date :
2012-05-05 15:19:50 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
นี่อ่ะค่ะโค้ด 
Code (PHP)
<?php
include("../../system_connecttion/connect.php");
$id = $_POST["id"];
$prefix = $_POST["prefix"];
$prefixName = $_POST["prefixName"];
$name = $_POST["name"];
$surname = $_POST["surname"];
$picture = $_FILES["picture"]["name"];
$tmppicture = $_POST["tmppicture"];
$tmppicture_old = $_POST["tmppicture_old"];
$usernames = $_POST["usernames"];
$passwords = $_POST["passwords"];
$address = $_POST["address"];
$province = $_POST["province"];
$amphur = $_POST["amphur"];
$district = $_POST["district"];
$telephone = $_POST["telephone"];
$mobile = $_POST["mobile"];
$email = $_POST["email"];
$Zipcode = $_POST["Zipcode"];
$PosID = $_POST["PosID"];
$PosMangeName = $_POST["PosMangeName"];
#$PostID = $_POST["PostID"];
$PosName = $_POST["PosName"];
$chkpermis = $_POST["chkpermis"];
$CreateDate = $_POST["CreateDate"];
$ysd=substr($CreateDate,0,4);
$msd=substr($CreateDate,5,2);
$dsd=substr($CreateDate,8,2);
$showdates=$dsd.'/'.$msd.'/'.($ysd+543);
$TrainDetailID = $_POST["TrainDetailID"];
$fax = $_POST["fax"];
$TopicTrain = $_POST["TopicTrain"];
$trainID_old = $_POST["trainID_old"];
if($tmppicture_old==$tmppicture){ // ถ้าเท่ากันคือ ไม่ได้เปลี่ยนรููป
$image = $tmppicture_old;
}
else{ // ไม่เท่ากันคือมีการเปลี่ยนรูป
$image = $tmppicture;
$a = explode("\\",$image); // เป็นการแปลงค่าสตริงหใ้เป็นอาร์เรย์ โดยการเช็คตามตัว คั่น เช่น /
if(count($a) > 0) //มากกว่า 1 ช่องไหม
{
$image = $a[count($a) -1]; //ถ้ามากกว่าก็จะทำการตัดออก เอามาแต่ตัวสุดท้าย
}
//echo $image;
move_uploaded_file($_FILES["picture"]["tmp_name"],"../../picture_person/".$image); //upload to server
}
$SQLupdatePersonal = "update member set
Prefix='$prefix',
Prefix_name='$prefixName',
name='$name',
image='$image',
telephone='$telephone',
address='$address',
email='$email',
usernames='$usernames',
passwords='$passwords',
mobile='$mobile',
Zipcode= '$Zipcode',
surname='$surname',
PosID='$PosMangeName',
PostID='$PosName',
TypeID='$chkpermis',
status='$chkpermis',
ProvinceID='$province',
AmphurID='$amphur',
DistrictID='$district'
where id='$id'";
//echo $SQLupdatePersonal."<br>";
$SQLresPersonal = mysql_db_query($db,$SQLupdatePersonal);
if($SQLresPersonal){ //////// ถ้าบันทึกลงตาราง research ได้ ให้ไปบันทึกข้อมูลที่เหลือลงไปในตาราง research_detail
if($PosName!=99){ ////PosMangeName!=99 99 คือ ตัวเลือกไม่มีตำแหน่ง
$SQLPos = "select * from position_detail order by PosDetailID desc limit 1";
//echo $SQLPos."<br>";
$RESPos = mysql_db_query($db,$SQLPos);
$NUMPos = mysql_num_rows($RESPos);
$VALPos = mysql_fetch_array($RESPos);
$idPos = $VALPos["PosDetailID"];
if($NUMPos==0){ $idPos = 1;}
else {$idPos = $idPos+1;}
$SQLaddpost = "INSERT INTO position_detail (PosDetailID,PosCreateDate,PostID,id)
VALUES('$idPos','$PosCreateDate','$PosName','$id')";
//echo $SQLaddpost."<br>";
$SQLrespost = mysql_db_query($db,$SQLaddpost);
}////PosMangeName!=99
if($PosMangeName!=99){ ////PosName!=99 99 คือ ตัวเลือกไม่มีตำแหน่ง
$SQLPosMange = "select * from posmanage_detail order by PosMangeID desc limit 1";
$RESPosMange = mysql_db_query($db,$SQLPosMange);
$NUMPosMange = mysql_num_rows($RESPosMange);
$VALPosMange = mysql_fetch_array($RESPosMange);
$idPosMange = $VALPosMange["PosMangeID"];
if($NUMPosMange==0){ $idPosMange = 1;}
else {$idPosMange = $idPosMange+1;}
$SQLaddPosMange = "INSERT INTO posmanage_detail (PosMangeID,PosMangeDate,PostID,id)
VALUES('$idPosMange','$PosMangeDate','$PosMangeName','$id')";
//echo $SQLaddPosMange."<br>";
$SQLresPosMange= mysql_db_query($db,$SQLaddPosMange);
} ////PosName!=99
}
if($SQLresPersonal){
echo "<script>alert ('บันทึกข้อมูลเรียบร้อย'); </script>";
echo "<script language='javascript' >window.location='../frm_update_personal.php?id=$id';</script>";
exit();
}
else{ #ถ้าmysql_db_query รันแล้ว Error ทำในนี้
echo "<script>alert ('ไม่สามารถบันทึกข้อมูลได้ กรุณาลองอีกครั้ง'); </script>";
echo "<script language='javascript' >window.location='../frm_update_personal.php?id=$id';</script>";
exit();
}
?>
|
 |
 |
 |
 |
Date :
2012-05-05 16:21:52 |
By :
phonyamon |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบสีเขียวคืดที่ถูกต้องเป็นการแก้ไขจาก Firefox และขอบสีแดงเป็นการแก้ไข chrome 
ขอบคุณน่ะค่ะ 
|
 |
 |
 |
 |
Date :
2012-05-05 16:28:07 |
By :
phonyamon |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอนที่เก็บน่าจะเก็บแค่ $_FILES["picture"]["name"] ครับ
|
 |
 |
 |
 |
Date :
2012-05-05 18:31:10 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ถ้าเก็บแบบ $_FILES["picture"]["name"] มันจะมาแค่ชื่อรูปน่ะค่ะ แต่นามสกุลรูปมันจะไม่มาด้วยน่ะค่ะ(SERVER เป็น Linux)
|
 |
 |
 |
 |
Date :
2012-05-05 18:59:16 |
By :
phonyamon |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|