|
 |
|
ถามเรื่องการอัพโหลดรูปครับ คือผมใช้หลักการนี้อัพโหลดรูปสมาชิกไว้ใน ไดเรคทอรี่ ครับ แล้วเซฟชื่อไฟล์ไว้ในฐานข้อมูล |
|
 |
|
|
 |
 |
|
ลองเอาไปปรับดูนะครับ
ผมใช้ประมาณนี้อ่ะครับ
Code (PHP)
<?php if(isset($_POST['btnInsert'])){
if($_FILES["fileUpload"]["tmp_name"]){
$fileUpload=$_FILES["fileUpload"]["tmp_name"];
$fileUpload_name=$_FILES["fileUpload"]["name"];
$filenewcon = strstr($fileUpload_name,'.');
$ext = strtolower(end(explode('.', $fileUpload_name)));
$dateUpFile=date("YmdHis");
$newname=$dateUpFile.".".$ext;
copy($_FILES["fileUpload"]["tmp_name"],"MyFiles/".$newname);
}
$objDB = mysql_select_db($database,$conn);
$strSQL = "INSERT INTO tblmember";
$strSQL .="(Images)";
$strSQL .="VALUES";
$strSQL .="('$newname',)";
$objQuery = mysql_query($strSQL) or die (mysql_error());
if($objQuery)
{
echo "<meta http-equiv='Content-Type' content='text/html; charset=tis620' />";
echo "<script language='javascript'>alert('บันทึกข้อมูลเรียบร้อยแล้ว...');</script>";
echo "<meta http-equiv='refresh' content='0;URL= ปลายทางที่จะไป'>"; // ใส่ลิงค์ปลายทางที่จะไปอ่ะครับ
echo "Save Done.";
}
else
{
echo "Error in SQL".mysql()."<br>";
echo "Error Save [".$strSQL."]";
}
}
?>
ได้ ไม่ได้งัยแจ้งผลกันบ้างนะครับ
|
 |
 |
 |
 |
Date :
2009-10-06 09:26:27 |
By :
pokultra |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณนะครับคุณ Rastafari เด๋วจะลองดูครับ
แต่ตอนนี้ขอไปสอบก่อนครับ หุหุ
|
 |
 |
 |
 |
Date :
2009-10-06 09:29:35 |
By :
tomrambo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณจ้า
|
 |
 |
 |
 |
Date :
2009-10-12 11:39:26 |
By :
apicha31 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|