|
|
|
ต้องการจะ upload image หลายๆๆๆรูปค่ะ ต้องการจะ upload image หลายๆๆๆ รูปค่ะ ต้องทำอย่างไรค่ะ |
|
|
|
|
|
|
|
ผมมีให้ได้เท่านี้ครับ
code เด็กๆ ทำ
<?
$q_topic = $_POST['q_topic'];
$q_detail = $_POST['q_detail'];
$q_post = $_POST['q_post'];
$q_email = $_POST['q_email'];
$q_count = maxid("tb_webboard_q","q_count");
//================= ร ูป ===============//
$pic_name = $_FILES['q_pic']['name'];
$pic_type = $_FILES['q_pic']['type'];
$pic_tmp_name = $_FILES['q_pic']['tmp_name'];
$pic_size = $_FILES['q_pic']['size'];
//================== ไฟล์ ==============//
$file_name =$_FILES['q_file']['name'];
$file_type = $_FILES['q_file']['type'];
$file_tmp = $_FILES['q_file']['tmp_name'];
$file_size = $_FILES['q_file']['size'];
if($_POST["Submit"] && $q_topic!=""){
if($pic_size >50*1024){
echo "<script>alert('คุณ UPLOAD รูปเกินขนาด');window.location = 'index.php?page=webboard_post';</script>";
exit();
}else if($pic_name ==""){
$pic_tmp_name = "upload/no_pic.gif";
$path0="upload/webboard/";
$f=date("dmyhns").".jpg";
$pic=$path0.$f;
copy($pic_tmp_name,$pic);
}else{
$path0="upload/webboard/";
$f=date("dmyhns").".jpg";
$pic=$path0.$f;
copy($pic_tmp_name,$pic);
}
//============= File ================//
if($file_size > 10000*1024){
echo "<script>alert('คุณ UPLOAD ไฟล์เกินขนาด');window.location = 'index.php?page=webboard_post';</script>";
exit();
}else if($file_name !=""){
$strname = strrev($_FILES['q_file']['name']);
$path2="upload/webboard/";
//$f=$file_name;
$f=date("dmyhns").".".strrev($strname[0].$strname[1].$strname[2]);
$files=$path2.$f;
copy($file_tmp,$files);
}else{
$files="";
}
$sql = "insert into tb_webboard_q set
q_topic = '$q_topic',
q_detail = '$q_detail',
q_post = '$q_post',
q_email = '$q_email',
q_pic = '$pic',
q_file = '$files',
q_date = now(),
q_count = $q_count";
$query = mysql_query($sql) or die ("error = $sql");
echo "<script>window.location = 'index.php?page=webboard'</script>";
}
?>
|
|
|
|
|
Date :
25 ส.ค. 2551 09:16:43 |
By :
นักศึกษาฝึกงาน |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|