|
 |
|
คือผมจะ upload file Zip,pdf ลงฐานข้อมูลอ่ะนครับทำไงครับเนี่ย อ่านในนนี้เห็นแต่อ้าง path |
|
 |
|
|
 |
 |
|
ทำถามงงครับ อิอิ
|
 |
 |
 |
 |
Date :
2009-06-23 10:22:52 |
By :
9811 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อัพโหลดไฟล์ ต้องสร้างโฟลเดอร์สำหรับเก็บไฟล์ที่เราจะอัพโหลด=====> ตรงนี้เก็บตัวไฟล์ครับ
สร้างตางรางเก็บข้อมูลที่อัพโหลด ในที่นี้ผมหมายถึง ชื่อไฟล์เพื่อเราจะเช็คได้ว่าไฟล์ที่เราอัพโหลดไปชื่อไฟล์อะไร ตอนดึงออกมาแสดงจะได้ตรงกัน
|
 |
 |
 |
 |
Date :
2009-06-23 12:03:06 |
By :
manop_cs |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมว่าเก็บแค่ path ของไฟล์ลงใน DB ส่วนไฟล์จิงเก็บไว้ที่อื่นกว่ามะ ถ้าเก็บไฟล์ลงในDB DB จะโตนะ
|
 |
 |
 |
 |
Date :
2009-06-23 12:48:54 |
By :
naskw |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คือประมาณว่า ตัวอย่างการ upload ไฟล์ ครับ เขียนแบบ ADODB
อาจจะเขียนไม่ค่อยเหมือนชาวบ้าน แต่ก็สะดวกดี
Code (PHP)
<?php
$save_dir = DOC_ROOT."/books"; // DOC_ROOT คือ getenv("DOCUMENT_ROOT");
$save_path = $save_dir . "/" . $_FILES['img']['name']; //รับค่า โพสต์ มาจาก form
if(!file_exists($save_dir))
{
mkdir($save_dir); ถ้าไม่มี folder ให้สร้าง
}
if(move_uploaded_file($_FILES['img']['tmp_name'], $save_path))
{
$imgbook = $_FILES['img']['name'];
$sql = <<<SQL
INSERT INTO $Table1 (title,author,call_no,ISBN,publisher,subject,new_date,imgbook)
values(?,?,?,?,?,?,?,?);
SQL;
$rs= $this->DB->Execute($sql,array($title,$author,$call_no,$ISBN,$publisher,$subject,$new_date,$imgbook));
}
?>
|
 |
 |
 |
 |
Date :
2009-06-23 15:10:10 |
By :
sirikulo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|