|
|
|
สอบถามเรื่องการ upload รูปแบบ web thaicreat.com ในการโพสหน่อยคับว่า ใช้วิธีการเขียนอย่างไร |
|
|
|
|
|
|
|
ยกให้เลยครับ
<?php
include'../connect/config.inc.php';
if($_GET['Action'] == 'UPload'){
/////////////////////รูปภาพ //////////////////////////
$uploadpath = "$website/upload/imageupload";
$uploadpath2 = "imageupload";
if(trim($_FILES["FileUpload"]["tmp_name"]) != ""){
$images = $_FILES["FileUpload"]["name"];
$tmp = $_FILES["FileUpload"]["tmp_name"];
$rand = substr(str_shuffle('ABCDEFGHIJKLMNOPQRSTUVWXYZ23456789'),0,15);
$new_images = $rand."-CNXGOLF_UPLOADFILE".$_FILES["FileUpload"]["name"];
move_uploaded_file($tmp,$uploadpath2."/".$new_images);
}
$sql = "insert into uploadimags(name,date,image) value('".$_POST['Name']."','".date('Y-m-d H:i:s')."','".$new_images."')";
$rs_upload = mysql_query($sql,$dbcon) or die (mysql_error().$sql);
$sqll = "select * from uploadimags where name = '".$_POST['Name']."'";
$result = mysql_query($sqll,$dbcon);
$arr = mysql_fetch_array($result);
$image = "[img]".$uploadpath."/".$arr['image']."[/img]";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="<?=$website?>/css/css.css" />
<title><?=$title?></title>
<meta name="Description" content="<?=$description?>" />
<meta name="Keywords" content="<?=$keyword?>" />
<style>
.bg_color_content{
background-color:#747474;
}
.text12-white{
font-size:12px;
color:#FFF;
}
.text14-orange{
font-size:14px;
color:#f7941d;
}
.text20-orenge{
font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
/* text-shadow:0.1em 0.1em 0.2em black; */
font-size:20px;
color:#f7941c;
}
.alert2{
color:#F00;
}
</style>
<script language="javascript">
function fncSubmit()
{
if(document.Upload.Name.value == "")
{
alert('กรุณาใส่คำอธิบายภาพ');
document.Upload.Name.focus();
return false;
}
document.Upload.submit();
}
</script>
</head>
<body>
<form name="Upload" method="post" action="?Action=UPload" enctype="multipart/form-data" onSubmit="JavaScript:return fncSubmit();">
<table width="500" border="0" align="left" cellpadding="0" cellspacing="5">
<tr>
<th colspan="2" class="bg_color_content text20-orenge">UPLOAD IMAGE</th>
</tr>
<tr>
<td width="22%" class="text14-orange">คำอธิบายไฟล์ (*)</td>
<td width="78%"><input type="text" name="Name" size="40" /></td>
</tr>
<tr>
<td class="text14-orange">เลือกไฟล์ (*)</td>
<td><input type="file" name="FileUpload" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="Upload" /></td>
</tr>
</table>
</form>
<table width="500" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td align="center" class="text12 alert2"> </td>
</tr>
<tr>
<td align="center" class="text12 alert2">หลังจากอัพโหลดไฟล์แล้วให้ Copy ข้อความนี้ไปวางในกระทู้</td>
</tr>
<tr>
<td align="center"><input type="text" size="70" value="<?=$image?>" style="text-align:center;" onclick="this.select()" /></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"><input type="button" value="ปิด" onclick="window.close()" /></td>
</tr>
<tr>
<td align="center" class="text12"> </td>
</tr>
<tr>
<td align="center" class="text12-white">อัพโหลดใช้เฉพาะในเว็บ <?=$website?> เท่านั้น ไม่ใช่ฟรีอัพโหลด</td>
</tr>
</table>
</body>
</html>
|
|
|
|
|
Date :
2016-08-18 14:46:34 |
By :
Dragons_first |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับ คุณDÜd€ :3และคุณหมาของเซสชั่น
|
|
|
|
|
Date :
2016-08-18 15:21:21 |
By :
thejaygt |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2016-08-19 09:13:03 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|