|
 |
|
อัพรุปลง path ที่ตั้งไว้ไม่ได้ไม่รุ้ว่าเกิดไรขึ้นไม่ทราบว่ามีปัญหาไรไหมหรือเขียนผิด |
|
 |
|
|
 |
 |
|
Code (PHP)
<?
//Function ติดต่อฐานข้อมูล
require_once('../config/config.php');
//require_once('../config/function.php');
$sql = "select * from chapter where Chapter_Id = '".$_GET["Chapter_Id"]."'"; //คำสั่ง SQL เพื่อการแสดงผล
$dbquery = mysql_query($sql);
$result = mysql_fetch_array($dbquery);
if($_GET["Action"] == "Save")
{
//ตัวแปรที่ได้จากการ get และ select หรือจากฐานข้อมูลนั่นเอง
$Subject_Id = $result["Subject_Id"];
$Chapter_Id = $_GET["Chapter_Id"];
//กำหนดค่าตัวแปรที่ได้ลงในฐานข้อมูลที่รับค่าได้มาจาก from
$Question = $_POST["txtQuestion"];
$Choice1 = $_POST["txtChoice1"];
$Choice2 =$_POST["txtChoice2"];
$Choice3 = $_POST["txtChoice3"];
$Choice4 = $_POST["txtChoice4"];
$Choice5 = $_POST["txtChoice5"];
$Choice6 = $_POST["txtChoice6"];
//---------------------------------//
//ก็อบรุปแล้วทำการอัพโหลด
//---------------------------------//
$path = "../teacher/picture/";//ที่อยุ่ไฟล์
copy($uploadfile,$path.$uploadfile_name);//อัพโหลดไฟล์ลงในโฟลืเดอร์
echo "ได้รับแฟ้มชื่อ $uploadfile_name ขนาด $uploadfile_size แล้ว
และ $uploadfile_name ลงdatabase";//Bebug
//*** Insert Single_Choice_Question ***//
$sql = "INSERT INTO single_question_choice
(Subject_Id, Chapter_Id ,
Picture , Question_Details , Choice_1 , Choice_2 , Choice_3 , Choice_4 , Choice_5 , Choice_6 ) VALUES ('$Subject_Id' , '$Chapter_Id', '$uploadfile_name' , '$Question' , '$Choice1' , '$Choice2' , '$Choice3' , '$Choice4' , '$Choice5' , '$Choice6' )" ;
mysql_query($sql);
echo "$sql";//ตรวจสอบผลที่ได้จากการส่งค่าจากคำสั่ง Debug
echo"<script language='JavaScript'>";
echo"alert('บันทึกข้อมูลเสร็จเรียบร้อบ');";
echo
"window.location='ShowQuestion.php?Chapter_Id=$_GET[Chapter_Id]';";
echo"</script>";
}
?>
คืออัพรูปไม่ได้เลยทั้งๆๆที่ตั้งโฟลืเดอร์อยู่ในตัวโค๊ดเลยครับไม่ทราบว่ามีปัญหาไรไหมหรือเขียนผิด
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2012-09-15 20:10:17 |
By :
dannan882 |
View :
997 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โหมด 777 ที่ โฟลเดอร์ picture หรือยังครับ 
|
 |
 |
 |
 |
Date :
2012-09-15 20:27:02 |
By :
apisitp |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ต้องการเทสในคอมเองครับ
ไม่ได้เอาไปอัพที่เซอเวอร์น่ะ
|
 |
 |
 |
 |
Date :
2012-09-15 21:20:29 |
By :
dannan882 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|