ผมทำ Upload File แล้วมันขึ้น Error Warning: copy('xxxx') [function.copy]: failed to open stream: Permission denied
Warning: copy(../Picture_Product/pic_270208144452.jpg) [function.copy]: failed to open stream: Permission denied in d:\ip1\author.co.th\www\Class\query_product.php on line 47
โดยที่ Code มันเป็นแบบนี้
<?
session_start();
include("../Config/config.inc.php");
$Product_Type=$_SESSION[session_product_type];
$Size_Id =$_SESSION[session_size_product];
$Cover_Product=$_SESSION[session_cover_product];
$paper_black=$_SESSION[session_paper_black];
$paper_color =$_SESSION[session_paper_color];
$cop=$_SESSION[session_cop];
$Username_Member=$_SESSION[session_user];
$Password_Member=$_SESSION[session_pwd];
$genid = date("dmyHis");
//µÃǨÊͺÊÁÒªÔ¡
if($Username_Member !="" && $Password_Member!=""){
$db_query_member_id=mysql_query("select * from member where Username='$Username_Member' and Password='$Password_Member'") or die("select Member_Id Error");
while($result_member_id=mysql_fetch_array($db_query_member_id)){
$Member_Id=$result_member_id[Member_Id];
}
}
//pictures
$file_upload_picture = $HTTP_POST_FILES['file_Work_Picture']['tmp_name'];
$file_name_picture = $HTTP_POST_FILES['file_Work_Picture']['name'];
$file_type_picture = $HTTP_POST_FILES['file_Work_Picture']['type'];
$file_size_picture = $HTTP_POST_FILES['file_Work_Picture']['size'];
$ext_picture = substr(strrchr($file_name_picture, "."),1);
//File µÑÇÍÂèÒ§
$file_upload_ex_product = $HTTP_POST_FILES['file_Ex_Work_Publish']['tmp_name'];
$file_name_ex_product = $HTTP_POST_FILES['file_Ex_Work_Publish']['name'];
$file_type_ex_product = $HTTP_POST_FILES['file_Ex_Work_Publish']['type'];
$file_size_ex_product = $HTTP_POST_FILES['file_Ex_Work_Publish']['size'];
$ext_ex_product = substr(strrchr($file_name_ex_product, "."),1);
//ÊÔ¹¤éÒ
$file_upload_product = $HTTP_POST_FILES['file_Work_Publish']['tmp_name'];
$file_name_product = $HTTP_POST_FILES['file_Work_Publish']['name'];
$file_type_product = $HTTP_POST_FILES['file_Work_Publish']['type'];
$file_size_product = $HTTP_POST_FILES['file_Work_Publish']['size'];
$ext_product = substr(strrchr($file_name_ex_product, "."),1);
if($Product_Type != "" && $Size_Id != "" && $Cover_Product !="" && $cop !="" && $Name_Product !="" && $Type_Book_Id != "" && $Full_Name_Work !="" && $Phone_Work !="" && $Work_Description != "" && $Work_Keyword !="" && $Work_Time !="" && $Member_Id != ""){
if($file_name_picture !=""){
if($ext_picture == "gif" || $ext_picture == "jpg" || $ext_picture == "jpeg" || $ext_picture == "png"){
$pathpic = "../Picture_Product/";
$NamefilepicProduct = "pic_".$genid.".".$ext_picture;
copy($file_upload_picture ,$pathpic.$NamefilepicProduct);
}
}elseif($file_name_picture ==""){
$NamefilepicProduct = "No_Pic.gif";
}
if($file_name_ex_product !=""){
if($ext_ex_product == "pdf"){
$path_ex_product = "../Ex_Product_File/";
$NamefileExProduct = "pdf_".$genid.".".$ext_ex_product;
copy($file_upload_ex_product ,$path_ex_product.$NamefileExProduct);
}
}elseif($file_name_ex_product==""){
$NamefileExProduct = "";
}
if($file_name_product !=""){
if($ext_product == "pdf"){
$path_product = "../Product_File/";
$NamefileProduct = "pdf_".$genid.".".$ext_product;
copy($file_upload_product ,$path_product.$NamefileProduct);
}
}elseif($file_name_product==""){
$NamefileProduct = "";
}
mysql_query("INSERT INTO product (Product_Code,Product_Type, Size_Id, paper_black, paper_color, Cover_Product, cop, Name_Product, Type_Id, Full_Name_Work, Phone_Work, Work_Description, Work_Keyword, Work_Time, Work_Comment, file_Work_Picture, file_Work_Publish, file_Ex_Work_Publish, ISBN, Member_Id,Type_Work) VALUES ('$genid','$Product_Type','$Size_Id', '$paper_black', '$paper_color', '$Cover_Product', '$cop', '$Name_Product', '$Type_Book_Id', '$Full_Name_Work', '$Phone_Work', '$Work_Description', '$Work_Keyword', '$Work_Time', '$Work_Comment', '$NamefilepicProduct', '$NamefileProduct', '$NamefileExProduct', '$Work_ISBN', '$Member_Id',1)") or die ("insert to Product Error");
$_SESSION[session_product_type]="";
$_SESSION[session_size_product]="";
$_SESSION[session_cover_product]="";
$_SESSION[session_paper_black]="";
$_SESSION[session_paper_color]="";
$_SESSION[session_cop]="";
header("location:../main.php?from=9");
}
?>
มัน Error เพราะอะไรคราบ ช้วยอธิบายให่ห้อยได้ไหมคราบTag : - - - -
Date :
27 ก.พ. 2551 14:51:49
By :
กิตติศักดิ์
View :
1587
Reply :
3
Path ไม่ถูกครับ เช็คดูดีๆ
Date :
27 ก.พ. 2551 21:53:36
By :
mkammarin
และอย่าลืมกำหนด Permission เป็น 777 ด้วยครับ
Date :
27 ก.พ. 2551 21:54:45
By :
mkammarin
permission 777 นี่ set ตรงไหนหรอครับ พอดีมีปัญหาเหมือนกานอ่ะครับ แต่มะรู้เรื่องเลยอ่ะ ของผมใช้ sql server มานจาเหมือนกานป่าวครับ
Date :
30 เม.ย. 2551 14:31:01
By :
asakura
Load balance : Server 04