|
 |
|
อยากจะให้หน้าที่เพิ่มข้อมูล สามารถอัพโหลดไฟล์ รูป ได้หลายๆๆอันนะครับ ช่วยดูไห้หน่อยครับ |
|
 |
|
|
 |
 |
|
อยากจะให้หน้าืัที่เพิ่มข้อมูล สามารถอัพโหลดไฟล์ รูป ได้หลายๆๆอันนะครับ ช่วยดูไห้หน่อยครับ
1. หน้้าอัพ

2. code แอด
Code (PHP)
<?
session_start();
//if ($_SESSION[sess_userid]<>session_id()) {
// header( "Location: admin.php"); exit();
//}
$fname=$_POST['fname'];
$fcompany=$_POST['fcompany'];
$position=$_POST['position'];
$shopname=$_POST['shopname'];
$address=$_POST['address'];
$tel1=$_POST['tel1'];
$tel2=$_POST['tel2'];
$email=$_POST['email'];
$website=$_POST['website'];
$type=$_POST['type'];
$area=$_POST['area'];
$subshop=$_POST['subshop'];
$other=$_POST['other'];
$photo=$_FILES['photo']['tmp_name'];
$photo_name=$_FILES['photo']['name'];
$photo_size=$_FILES['photo']['size'];
$photo_type=$_FILES['photo']['type'];
$date_today=date("Y-m-d");
$time_today=date("H:i:s");
/*if ($fname=="" ) {
echo "<H1> سҡ͡ú </H1>";
exit();
}*/
include "connect.php";
// mysql
mysql_query("SET NAMES UTF8");
$sql="INSERT INTO leasing
VALUES('null','$fname','$fcompany','$position','$shopname', '$address','$tel1','$tel2','$email','$website','$type','$area','$subshop','$other','','$date_today','$time_today')";
mysql_db_query("$dbname",$sql);
$ext = strtolower(end(explode('.', $photo_name)));
if ($ext == "jpg" or $ext == "jpeg" or $ext=="mp4") {
$sql="select max(id_new) from leasing";
$result=mysql_db_query($dbname,$sql);
$r=mysql_fetch_array($result);
$id_max=$r[0];
$filename=$id_max.".".$ext;
copy($photo,"photo/$filename");
$sql="update leasing set photo_new='$filename' where id_new='$id_max' ";
mysql_db_query($dbname,$sql);
}
echo "<center><H5>Please Wait</H5></center></br>";
echo "<meta http-equiv='refresh' content='0; url=finish.php'>";
include("mail.php");
mysql_close();
?>
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2014-02-17 18:57:18 |
By :
วันพีช |
View :
733 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|
|

|
Load balance : Server 02
|