|
![](/images/resource/spacer.gif) |
|
ช่วยดูโค้ดให้หน่อยค่ะ PHP PDO อัปโหลดไฟล์ลงฐานข้อมูล แต่ไฟล์ไม่ลงในโฟลเดอร์ใน server |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ไม่ path ผิดก็ permission ละครับ ผมว่า
ก่อนอื่นลอง echo $path/$temp;
ว่า path ถูกต้องหรือเปล่า
ถ้าถูกแล้วก็ไปเช็ค permission ของ folder ว่าเป็นอะไรสามารถเขียนไฟล์ได้หรือเปล่า
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2018-09-17 14:27:12 |
By :
DK |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
/ มันมองเป็นเครื่องหมายอะหนู หนูก็ใส่ ดับเบิ้ลโคด ครอบมันสิ หรือไม่ก็ทำให้มันเป็น string
ex 1 echo "$path/$temp" ใช้สติก่อนก๊อบไปว่างนิดนืงจ๊ะ ขอให้โชคดี
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2018-09-17 17:17:45 |
By :
DK |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
move_uploaded_file($temp,"$path/$name"); น่าจะสลับกันนะ
Code (PHP)
include('conn.php');
date_default_timezone_set('Asia/Bangkok');
if(isset($_POST['btnSubmit'])!=""){
$path="infor";
$name = $_FILES['filGalleryShot']['name'];
$size = $_FILES['filGalleryShot']['size'];
$type = $_FILES['filGalleryShot']['type'];
$temp = $_FILES['filGalleryShot']['tmp_name'];
$date = date('Y-m-d H:i:s');
move_uploaded_file($temp,"$path/$name");
$strSQL=$conn->exec("INSERT INTO infor (id,file,date) VALUES ('".$_GET["id"]."','".$name."','".$date."')");
}
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2018-09-18 08:58:33 |
By :
arm8957 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 01
|