Warning: copy() [function.copy]: open_basedir restriction in effect. File(C:\Windows\Temp\phpAD8D.tmp) is not within the allowed path(s): (D:\Inetpub\vhosts\winthipshop.com\httpdocs\) in D:\Inetpub\vhosts\winthipshop.com\httpdocs\admin\pro_add.php on line 33
ีup รูป ขึ้น sever ไม่โชว์ค่ะ แต่ file รูปเข้าฐานข้อมูลนะค่ะ แต่มันไม่โชว์รูปในเว็บอะค่ะ sever เป็น windows
มีวีธีแก้ไขบ้างมั้ยค่ะ
Code (PHP)
<?
session_start();
include("../inc/libdb.php");
include("../admin/checklogin_admin.php");
ConnectDB();
if($save) {
$SQL="SELECT * FROM product WHERE pro_serial ='$pro_serial' LIMIT 1;";
$RS = mysql_query($SQL);
if(mysql_num_rows($RS)==1){
echo "<script language=\"javascript\">alert('ขอโทษค่ะ ชื่อรหัสสินค้าซ้ำ');history.back();</script>";
CloseDB();
exit();
}
$SQL="INSERT INTO product (pro_serial,pro_type_id,pro_type2_id,pro_type3_id,pro_type4_id,pro_type5_id,pro_type6_id,pro_name,pro_detail,pro_price,pro_check_id,pro_buy_id,image)
values ('$pro_serial','$pro_type','$pro_type2','$pro_type3','$pro_type4','$pro_type5','$pro_type6','$pro_name',
'$pro_detail','$pro_price','$pro_check','$pro_buy ',$pic_name')";
mysql_query($SQL);
if($image){
$code = mysql_insert_id();
$file = explode(".",$image_name);
$file = sprintf("%05d",$code).".$file[1]";
mysql_query("UPDATE product SET image='$file' where pro_id =$code LIMIT 1;") or die (mysql_error());
copy($image,"../img/product/$file");
echo "<script language=\"javascript\">alert('ระบบได้ทำการบันทึกข้อมูลเรียบร้อยแล้วค่ะ');</script>";
echo "<script language=\"JavaScript\">parent.location.href='pro_add.php';</script>";
}
CloseDB();
exit();
}
?>
Tag : PHP, MySQL, CakePHP
Date :
2012-05-12 10:35:42
By :
sine
View :
1142
Reply :
6
No. 1
Guest
แก้ไข code นะค่ะ อันที่ถูก
Code (PHP)
<?
session_start();
include("../inc/libdb.php");
include("../admin/checklogin_admin.php");
ConnectDB();
if($save) {
$SQL="SELECT * FROM product WHERE pro_serial ='$pro_serial' LIMIT 1;";
$RS = mysql_query($SQL);
if(mysql_num_rows($RS)==1){
echo "<script language=\"javascript\">alert('ขอโทษค่ะ ชื่อรหัสสินค้าซ้ำ');history.back();</script>";
CloseDB();
exit();
}
$SQL="INSERT INTO product (pro_serial,pro_type_id,pro_type2_id,pro_type3_id,pro_type4_id,pro_type5_id,pro_type6_id,pro_name,pro_detail,pro_price,pro_check_id,pro_buy_id)
values ('$pro_serial','$pro_type','$pro_type2','$pro_type3','$pro_type4','$pro_type5','$pro_type6','$pro_name',
'$pro_detail','$pro_price','$pro_check','$pro_buy')";
mysql_query($SQL);
if($image){
$code = mysql_insert_id();
$file = explode(".",$image_name);
$file = sprintf("%05d",$code).".$file[1]";
mysql_query("UPDATE product SET image='$file' where pro_id =$code LIMIT 1;") or die (mysql_error());
copy($image,"../img/product/$file");
echo "<script language=\"javascript\">alert('ระบบได้ทำการบันทึกข้อมูลเรียบร้อยแล้วค่ะ');</script>";
echo "<script language=\"JavaScript\">parent.location.href='pro_add.php';</script>";
}
CloseDB();
exit();
}
?>