|
 |
|
จนปัญญาแล้วค่ะ ไม่สามารถอัพรูปเข้าโฟลเดอร์ที่กำหนดได้ รบกวนช่วยทีนะคะ |
|
 |
|
|
 |
 |
|
จาก code ด้านล่าง กดอัพโหลดแล้ว ชื่อไฟล์ถูกเก็บลงฐานข้อมูล แต่ไฟล์รูปไม่อัพเข้าในโฟลเดอร์ slipimg ค่ะ
ปล.ห้อง slipimg อยู่นอกห้องไฟล์ php นี้ค่ะ รบกวนทีนะคะ ขอบคุณค่ะ
Code (PHP)
<?
if(isset($_POST['submit'])){
$photoid = date('Y-m-d');
if($_FILES["photoslip"]["name"] != "")
{
$name=$_FILES['photoslip']['name'];
$tmp=$_FILES['photoslip']["tmp_name"];
$date_time=date("Y-m-d H:i:s");
$oldname=explode(".",$name);
$ext = "";
$ext = ".".$oldname[count($oldname)-1];
$photoslip ="PAY-".$photoid.$ext;
copy($tmp,"../slipimg/".$photoslip);
}else{
$photoslip = "";
}
mysqli_query($conn,"INSERT INTO registertb (id,name,photoslip) values('','$_POST[name]','$photoslip')") or die ("Cannot Add Database");
echo "<script>
function func1() {
swal({title: \"Update Success!\",text: \"บันทึกข้อมูลสำเร็จ!!\",type: \"success\",confirmButtonClass: \"btn-raised btn-primary\",confirmButtonText: \"OK\"},function(ok){window.location.href = \"index.php\";})
}
window.onload=func1;
</script>";
}
<form method="post" class="form-horizontal" name="talkform" enctype="multipart/form-data">
<div class="form-group">
<label style="font-size:14px;color:#fff;">ชื่อ-นามสกุล</label>
<input type="text" name="name" class="form-control" autocomplete="off" placeholder="ชื่อ-นามสกุล" style="width:100%" required >
</div>
<div class="form-group">
<label style="font-size:14px;color:#fff;">ไฟล์สลิปการโอน</label>
<input type="file" name="photoslip" class="form-control" autocomplete="off" placeholder="ไฟล์สลิปการโอน" style="width:100%" >
</div>
<button type="submit" id="submit" name="submit" class="btn btn-primary">SAVE-บันทึกข้อมูล</button>
</form>
?>
Tag : PHP, MySQL, HTML

|
|
 |
 |
 |
 |
Date :
2019-10-22 12:04:13 |
By :
because |
View :
565 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$photoslip ="PAY-".$photoid.$ext; //เช็คตัวแปรตัวนี้ก่อนออกมาถูกรึเปล่า
|
ประวัติการแก้ไข 2019-10-22 12:18:05
 |
 |
 |
 |
Date :
2019-10-22 12:17:36 |
By :
Genesis™ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|