ช่วยด้วยค่ะ ก๊อปรูป ลง path ไม่ได้อะค่ะ มันลงแต่ฐานข้อมูลอะค่ะ ชื่อรูป แต่ตัวรูปไม่ลงโฟลเดอร์อะค่ะ ไม่รู้จะแก้ยังไงละค่ะ
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?
include("../../config/connect.php");
include("../../config/config.php");
include("../../config/func.inc.php");
$resultlogin=get_a_line("select * from admin where id=".mySQLSafe($_COOKIE['admin_login'])."and display='1'");
$ChkLogin=count(get_rsltset("select * from admin where id=".mySQLSafe($_COOKIE['admin_login'])."and display='1'"));
if(empty($ChkLogin)){ echo "<script language=Javascript>window.location.href=\"index.php\";</script>"; }
$id_simg=$_GET['id_simg']?$_GET['id_simg']:$_POST['id_simg'];
if(!empty($_POST["status"]) && $_POST["status"]=="save")
{
$sql=get_a_line("select * from simg where id_simg='$id_simg'");
$old_pic=$_POST['old_pic'];
if($_FILES['pic']['tmp_name']==''){
$thume_Nname=$old_pic;
}elseif($_FILES['pic']['tmp_name']!='') {
list($w1,$h1)=getimagesize($_FILES['pic']['tmp_name']);
$exm=checkfile($_FILES['pic']['type']);
$thume_Nname=time().random_id(7).$exm;
if($w1>$cfg['service']['w']){
resizeImage($_FILES['pic']['tmp_name'],$cfg['service']['path'],$thume_Nname,$cfg['service']['w']) ;
}else{
copy($_FILES['pic']['tmp_name'],$cfg['service']['path'].$thume_Nname);
}
}
//update data
$sql="update simg set pic='".$thume_Nname."',name='".$_POST['name']."' where id_simg='$id_simg'";
if(RunSQL($sql))
{
echo PHPalert('Save Completed');
echo "<script>window.close();</script>";
$sql_ok="yes";
exit;
}
}
$sql="select * from simg where id_simg='$id_simg' ";
$result=mysql_query($sql) or die (mysql_error());
$show=mysql_fetch_array($result) or die (mysql_error());
?>
<!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=windows-874" />
<title><?=$cfg['admin']['title']?></title>
<link rel="shortcut icon" href="img/siri.ico" type="image/x-icon" />
<style media="all" type="text/css">
@import "css/admin.css";
@import "css/calendar.css";
</style>
<script language="javascript" src="include/ajax.js"></script>
<SCRIPT LANGUAGE="JavaScript" SRC="interface/dhtml.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="interface/anthill.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="interface/calendar.js"></SCRIPT>
<style type="text/css">
<!--
body,td,th {
font-family: tahoma, MS Sans Serif;
font-size: 12px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #FFFFFF;
}
-->
</style>
</head>
<body><table width="47%" height="124" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr bgcolor="f7f7f7">
<td height="122" align="center" valign="middle" bgcolor="#f7f7f7">
<form action="" method="post" enctype="multipart/form-data" name="adminform" id="adminform">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><table width="96%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td><span class="header1"><strong>Add / Edit Images </strong></span></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="middle">
<td width="51%"> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><br />
<table width="100" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td><table width="510" border="0" cellpadding="6" cellspacing="1" class="setborder"style="border:1px solid #C8C8C8;"><tr><td width="551"><table width="496" border="0" cellpadding="6" cellspacing="1" class="setborder"style="border:1px solid #C8C8C8;">
<tr>
<td align="center">ชื่อรูป :</td>
<td><input name="name" type="text" id="name" size="45" value="<?=$show['name'];?>"/></td>
</tr>
<tr>
<td width="113" align="center">รูปภาพ : </td>
<td width="482"><img src="../../images/service/<?=$show['pic'];?>" width="137" height="88" border="0"/> </td><input name="old_pic" type="hidden" id="old_pic" value="<?=$show['pic'];?>" />
</tr>
<tr>
<td align="center">เลือกรูป : </td>
<td><input name="pic" type="file" size="40" /> </td>
</tr>
<tr>
<td align="center"> </td>
<td>* รูปต้องเป็น .jpeg หรือ .jpg * กว้าง <span class="font12red">
<?=$cfg['service']['w']?>
</span> px, สูง <span class="font12red">
<?=$cfg['service']['h']?>
</span> px</td>
</tr>
<tr>
<td align="center"> </td>
<td><input type="button" name="Button" value="Save Photo" onClick="chk()"/></td>
</tr>
</table></td>
</tr>
</table>
<input name="status" type="hidden" id="status" /></td>
</tr>
</table>
<input type="hidden" name="id_simg" value="<?=$_GET['id_simg']?>" />
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<script language="JavaScript" src="<?=$cfg['main']['url']?>/include/script.js"> </script>
<script language="JavaScript">
var obj=document.adminform;
function chk()
{
var filebig=document.adminform.pic.value.toLowerCase(); //เนเธเนเธ•เธฃเธ pic เธ”เนเธงเธข
if( document.adminform.pic.value !='' ){
if(filebig.substring(filebig.length-4,filebig.length)!='.jpg'&&filebig.substring(filebig.length-5,filebig.length)!='.jpeg')
{
alert('photo must be .jpeg or .jpg');
return false;
}
} obj.status.value="save";
obj.submit();
}
</script>
</body>
</html>
มันลงแต่ฐานข้อมูลอะค่ะ ชื่อรูป แต่ตัวรูปไม่ลงโฟลเดอร์อะค่ะ ไม่รู้จะแก้ยังไงละค่ะ
ช่วยด้วยค่ะ ขอบคุณทุกคำตอบค่ะTag : - - - -
Date :
2010-04-16 11:54:22
By :
kwangz_07
View :
871
Reply :
1
Load balance : Server 05