ช่วยดูโค๊ดให้หน่อยครับ ลบไฟล์ในโฟล์ดเดอร์ไม่ได้ ไฟล์ภาพน่ะครับ
โค๊ดครับ
เห็นชื่อรูปครับ แต่ลบไม่ออก ช่วยดูให้ทีครับ
Code (PHP)
<?php ob_start() ?>
<?
include "../include/function.inc.php";
include "../include/config.inc.php";
?>
<?
switch($hidAction)
{
case "Edit":
$sql = "select * from tbl_name where id_name='$id_name'";
$dbquery = mysql_db_query($dbname, $sql);
$result = mysql_fetch_array($dbquery);
$pic = $result[name_pic];
if($pic!="") {
echo $show_pic = "../images/preson/$pic";
@unlink($show_pic);
}
if($file[1]!="") {
if($p==1) {
$date_scat.=date("U");
$type=getimagesize($file[1]);
if($type[2]==1){
$img_product1=$date_scat."_person.gif";
}else if($type[2]==2){
$img_product1=$date_scat."_person.jpg";
}
else{
$img_product1=$date_scat."_person.png";
}
copy ($file[1] ,"../images/person/$img_product1");
//chmod("../images/person/$img_product1", 0644);
}
}
$date=date("Y-m-d");
echo $sql="update tbl_name set names='$names',name_pic='$img_product1',type='$p',date='$date' where id_name='$id_name'";
$dbquery = mysql_db_query($dbname, $sql);
//JSError(3, "", "show_name.php");
mysql_close();
break;
} ?>
<html>
<head>
<?
include "../include/config.inc.php";
$sql = "select * from tbl_name where id_name='$id_name'";
$dbquery = mysql_db_query($dbname, $sql);
$result = mysql_fetch_array($dbquery);
$id_name = $result[id_name];
$names = $result[names];
$pic = $result[name_pic];
$name_pic = "../images/person/$pic";
$name_picn = "../images/person/noperson";
?>
<title>One-stop Control Panel</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="css_admin.css" rel="stylesheet" type="text/css">
<script language="javascript" src="script/allfunction.js"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
</head>
<body bgcolor="#F5F5F5" >
<form action="<?=$PHP_SELF;?>" method="post" enctype="multipart/form-data" name="frm_edit" id="frm_edit">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="f13">
<tr>
<td width="30" height="25"></td>
<td valign="bottom"> <table border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="26" valign="bottom"> <table border="0" cellpadding="0" cellspacing="0" class="tb_button" height="25" width="184">
<tr>
<td width="182" align="center" valign="middle" bgcolor="#FFFFFF"><img src="images/icon_edit.gif" width="16" height="16" align="absmiddle" ><strong> แก้ไข</strong><b>ข้อมูลผู้เชี่ยวชาญ</b></td>
</tr>
</table> </td>
</tr>
</table></td>
</tr>
<tr bgcolor="#176B00">
<td height="4" colspan="2" valign="top" bgcolor="#FF9999"><img src="images/spacer.gif" width="1" height="1"></td>
</tr>
<tr>
<td height="10" valign="top"><img src="images/spacer.gif" width="1" height="1"></td>
<td valign="top"><img src="images/spacer.gif" width="1" height="1"></td>
</tr>
<tr>
<td></td>
<td align="left" valign="top"><table width="800" border="0" align="left">
<tr>
<td colspan="3" class="f11"> </td>
</tr>
<tr>
<td width="180" class="f11">ชื่อ-นามสกุล :</td>
<td colspan="2" class="f11"><input name="names" type="text" class="box" id="names" value="<?=$names;?>" size="150" maxlength="150"></td>
</tr>
<tr>
<td class="f11"> </td>
<td width="573" colspan="2" class="f11"> </td>
</tr>
<tr>
<td class="f11"> </td>
<td class="f11"><strong>
<input name="p" type="radio" value="1" checked>
ภาพนิ่ง รูปภาพ ขนาด 110*130 (ประเภท .jpg หรือ .gif หรือ .png)</strong></td>
<td class="f11"> </td>
</tr>
<tr>
<td class="f11"> </td>
<td align="left" valign="middle" nowrap bgcolor="<?=$bg;?>" class="f13"><? if($pic!=""){?>
<a href="<?=$name_pic;?>"><img src="<?=$name_pic;?>" alt="" width="110" height="130" border="0"></a>
<? } else {?>
<img src="<?=$name_picn;?>" alt="" width="110" height="130" border="0">
<? } ?></td>
<td class="f11"> </td>
</tr>
<tr>
<td class="f11"> </td>
<td class="f11"><input name="file[1]" type="file" id="file[1]" onpropertychange="showPic(this)">
</td>
<td class="f11"> </td>
</tr>
<tr>
<td class="f11"> </td>
<td class="f11"> </td>
<td class="f11"> </td>
</tr>
<tr>
<td colspan="3" class="f11"><table width="100%" border="0">
<tr>
<td width="43%" align="right"><input type="submit" name="Submit" value="แก้ไขข้อมูล" class="box2">
<input name="hidAction" type=hidden class="f12" value="Edit" size=20 maxlength=20>
<input name="name_pic" type=hidden class="f12" value="<?=$name_pic;?>" size=20 maxlength=20>
<input name="id_name" type=hidden class="f12" value="<?=$id_name;?>" size=20 maxlength=20></td>
<td width="57%"><input name="cancle" type="reset" class="box3" id="cancle" value="cancel"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="1"><img height="1" width="30" src="/images/spacer.gif"></td>
<td><img height="1" width="234" src="/images/spacer.gif"></td>
</tr>
</table>
</form>
</body>
</html>
<?php ob_end_flush() ?>
Tag : PHP, CakePHP
Date :
2011-01-21 14:49:23
By :
fujisawa10
View :
869
Reply :
3
วานผู้รู้ช่วยหน่อยครับ
Date :
2011-01-21 14:58:27
By :
fujisawa10
ลองเอา @ ออกดูครับ ว่ามันจะฟ้องว่าไง
Date :
2011-01-21 15:45:51
By :
PlaKriM
Warning: unlink(../images/preson/../images/person/1295598044_person.jpg) [function.unlink]: No such file or directory in D:\AppServ\www\onestop\adminweb\frm_edit_name.php on line 16
เอาออกแล้วฟ้องแบบนี้ครับ
Date :
2011-01-21 15:56:35
By :
fujisawa10
Load balance : Server 00