ขึ้นฟ้องว่า Warning: copy(yala2012.jpg) [function.copy]: failed to open stream: No such file or directory in C:\AppServ\www\telephone\addtel.php on line 43 failed to copy yala2012.jpg
มันขึ้นฟ้องว่า Warning: copy(yala2012.jpg) [function.copy]: failed to open stream: No such file or directory in C:\AppServ\www\telephone\addtel.php on line 43
failed to copy yala2012.jpg
นี้เป็นโค๊ดรับไฟล์คะ
Code (PHP)
<?
include "config.inc.php";
include "$language.php";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE><?echo ""._NAMEAPP." v.$version" ?></TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="Phuttarak M. [email protected] ">
<META NAME="Keywords" CONTENT="telephone, phuttarak, email, contact, search, mobile, customer, web, <?echo ""._NAMEAPP."";?>">
<META NAME="Description" CONTENT=<?echo ""._NAMEAPP."";?>>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<style type="text/css">
<!--
body {margin: 0px 0px; padding: 0px 0px ; font-family: MS Sans Serif ; font-size: 10pt}
a:link {text-decoration: none; color: blue }
a:visited {text-decoration: none; color: blue }
a:hover {text-decoration: none; color: red }
a:active {text-decoration: none; color: blue }
p, div, td, ul li, ol li { font-family: MS Sans Serif, Microsoft Sans Serif; font-size: 10pt }
-->
</style>
</HEAD>
<body bgcolor=#FFFFF0>
<center>
<!-- ตาราง -->
<table border=1 width=95% bordercolor=#1E90FF cellspacing=0 cellpadding=3>
<tr><td align=center bgcolor=#1E90FF>
<font size=3 color=#FFF5EE><b><?echo ""._DETAIL."";?></b></font>
</td></tr>
<tr><td>
<form action="addtel.php" name="add_tel" method ="POST">
<table border=0 width=100%>
<tr>
<td align=right width=15%><?echo ""._TITLE."";?> : </td>
<td align=left>
<SELECT NAME="TITLE">
<OPTION></OPTION>
<OPTION>Dr.</OPTION>
<OPTION>KHUN</OPTION>
<OPTION>Miss</OPTION>
<OPTION>Mr.</OPTION>
<OPTION>Mrs.</OPTION>
<OPTION SELECTED>คุณ</OPTION>
<OPTION>คุณป้า</OPTION>
<OPTION>คุณแม่</OPTION>
<OPTION>คุณหญิง</OPTION>
<OPTION>ดร.</OPTION>
<OPTION>นอ.หญิง</OPTION>
<OPTION>นพ.</OPTION>
<OPTION>ผศ.ดร.</OPTION>
<OPTION>พ.ต. หญิง</OPTION>
<OPTION>พ.ต.ต.</OPTION>
<OPTION>พ.ต.ต.หญิง</OPTION>
<OPTION>พ.อ.หญิง</OPTION>
<OPTION>พญ.</OPTION>
<OPTION>พล.ต.</OPTION>
<OPTION>ม.ร.ว.</OPTION>
<OPTION>ม.ล.</OPTION>
<OPTION>ร.ต.ท.</OPTION>
<OPTION>ร.ต.อ.</OPTION>
<OPTION>ศ.น.พ.</OPTION>
<OPTION>ส.ต.ท.</OPTION>
<OPTION>อาจารย์</OPTION>
</SELECT>
</td>
</tr>
<tr>
<td align=right width=15%> <?echo ""._NAME."";?> : </td>
<td><input type=text name="NAME" size=14 maxlength=30> <input type=text name="SURNAME" size=14 maxlength=30></td>
</tr>
<tr>
<td align=right width=15%><?echo ""._NICKNAME."";?> : </td>
<td><input type=text name="NICK" size=5 maxlength=15>
</td>
</tr>
<tr>
<td align=right ><?echo ""._POSITION."";?> : </td>
<td><input type=text name="POSITION" size=30 maxlength=50></td>
</tr>
<tr>
<td align=right><?echo ""._HOME."";?> : </td>
<td><input type=text name="TEL_HOME" size=30 maxlength=30></td>
</tr>
<tr>
<td align=right><?echo ""._OFFICE."";?> : </td>
<td><input type=text name="TEl_OFF" size=30 maxlength=30 value="0-2xxx-xxxx" onClick="SelText();"></td>
</tr>
<tr>
<td align=right><?echo ""._MOBILE."";?> : </td>
<td><input type=text name="MOBILE" size=30 maxlength=30> </td>
</tr>
<tr>
<td align=right><?echo ""._FAX."";?> : </td>
<td><input type=text name="FAX" size=30 maxlength=30></td>
</tr>
<tr>
<td align=right><?echo ""._ADDRESS."";?> : </td>
<td><input type=text name="ADDRESS_1" size=35 maxlength=75> </td>
</tr>
<tr>
<td align=right> </td>
<td><input type=text name="ADDRESS_2" size=35 maxlength=75></td>
</tr>
<tr>
<td align=right><?echo ""._EMAIL."";?> : </td>
<td><input type=text name="E_Mail" size=35 maxlength=254> </td>
</tr>
<tr>
<td align=right> <?echo ""._URLIMAGE."";?> : </td>
<td><input type="hidden" name="max_file_size" value="10248576">
<input name="userfile" type="file"></a></td>
</tr>
<tr>
<td align=center colspan=2> <input type=submit value=" <?echo ""._SAVE."";?> ">
</td>
</tr>
</table>
<!-- close table -->
</td></tr>
</table>
<!-- close table -->
</form>
</center>
<script language="JavaScript">
<!-- //
function BodyOnLoad()
{
if (document.add_tel.TEl_OFF) {
document.add_tel.TEl_OFF.focus();
document.add_tel.TEl_OFF.select();
}
}
function SelText()
{
if (document.add_tel.TEl_OFF.value == "0-2xxx-xxxx")
{
document.add_tel.TEl_OFF.value = "";
}
}
BodyOnLoad();
// -->
</script>
<script language="JavaScript">
<!--
function check()
{
var v1 = document.SearchForm.search.value;
if ( v1.length==0)
{
alert("กรุณาป้อนคำที่ต้องการค้นหา");
document.SearchForm.search.focus();
return false;
}
else
return true;
}
//-->
</script>
</body>
</html>
นี้หน้าบันทึก
Code (PHP)
<?
include "config.inc.php";
include "$language.php";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE><?echo ""._NAMEAPP." v.$version" ?></TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="Phuttarak M. [email protected] ">
<META NAME="Keywords" CONTENT="telephone, phuttarak, email, contact, search, mobile, customer, web, <?echo ""._NAMEAPP."";?>">
<META NAME="Description" CONTENT=<?echo ""._NAMEAPP."";?>>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<style type="text/css">
<!--
body {margin: 0px 0px; padding: 0px 0px ; font-family: MS Sans Serif ; font-size: 10pt}
a:link {text-decoration: none; color: blue }
a:visited {text-decoration: none; color: blue }
a:hover {text-decoration: none; color: red }
a:active {text-decoration: none; color: blue }
p, div, td, ul li, ol li { font-family: MS Sans Serif, Microsoft Sans Serif; font-size: 10pt }
-->
</style>
</HEAD>
<body bgcolor="FFFFF0">
<center>
<font size=2 face="MS Sans Serif, Arial">
<h2><font color=blue></font>
<?php
//echo "ตัวแปร user file =$userfile <br> \n";
//echo "<h2><font face=\"Verdana\">"._ADDNUMBER."</font></h2>";
echo ""._FILENAME." = $userfile_name <br> \n";
echo ""._FILESIZE." = $userfile_size byte<br> \n";
echo ""._FILETYPE." = $userfile_type <br> \n";
if (!copy($userfile, $directory.$userfile_name)) {
print("failed to copy $userfile <br>\n");
}
//กรณีเป็นไฟล์ข้อความ
if ($userfile_type == 'text/plain'){
}
//กรณีเป็นไฟล์รูปภาพ
else if ( ($userfile_type == 'image/pjpeg') ||
($userfile_type == 'image/bmp') ||
($userfile_type == 'image/gif') )
{
//กำหนด forder ที่ไฟล์อยู่ออกมาโชว์
echo "<br><a href=\"images/$userfile_name\"><img src=images/$userfile_name boder=\"1\"></a> <br>\n";
echo "<FONT COLOR=\"red\"><br> "._URLIMAGE." </FONT> = images/$userfile_name <br>\n";
}
//กรณีไม่เป็นไฟล์ข้อความและรูปภาพ
//else
//{
//echo "Other file type<br>\n";
//}
//echo " <p><a href=\"fileupload.php\" > "._BACK." </a> | <a href=\"add.php\"> "._ADDNUMBER." </a> \n";
?>
</font></h2>
</font>
</center>
<font size=2 face="MS Sans Serif, Arial">
<?
include("config.inc.php");
$ID = trim(htmlspecialchars($ID));
$TITLE = trim(htmlspecialchars($TITLE));
$NAME = trim(htmlspecialchars($NAME));
$SURNAME = trim(htmlspecialchars($SURNAME));
$NICK = trim(htmlspecialchars($NICK));
$POSITION = trim(htmlspecialchars($POSITION));
$BUSINESS = trim(htmlspecialchars($BUSINESS));
$COMPANY = trim(htmlspecialchars($COMPANY));
$OF_Bu = trim(htmlspecialchars($OF_Bu));
$TEl_OFF = trim(htmlspecialchars($TEl_OFF));
$TEL_HOME = trim(htmlspecialchars($TEL_HOME));
$FAX = trim(htmlspecialchars($FAX));
$MOBILE = trim(htmlspecialchars($MOBILE));
$PAGER = trim(htmlspecialchars($PAGER));
$ADDRESS_1 = trim(htmlspecialchars($ADDRESS_1));
$ADDRESS_2 = trim(htmlspecialchars($ADDRESS_2));
$E_Mail = trim(htmlspecialchars($E_Mail));
$SEND = trim(htmlspecialchars($SEND));
$Discount = trim(htmlspecialchars($Discount));
$nameweb = trim(htmlspecialchars($nameweb));
$pic_name = trim(htmlspecialchars($pic_name));
//กำหนดการติดต่อฐานข้อมูล
mysql_connect($host,$user,$passwd);
$sql ="insert into $table (ID,TITLE,NAME,SURNAME,NICK,POSITION,BUSINESS,COMPANY,OF_Bu,TEl_OFF,TEL_HOME,FAX,MOBILE,PAGER,ADDRESS_1,ADDRESS_2,E_Mail,SEND,Discount, nameweb,pic_name) values ('','$TITLE','$NAME','$SURNAME','$NICK','$POSITION','$BUSINESS','$COMPANY','$OF_Bu','$TEl_OFF','$TEL_HOME','$FAX','$MOBILE','$PAGER','$ADDRESS_1','$ADDRESS_2','$E_Mail','$SEND','$Discount','$nameweb','$pic_name')";
//ติดต่อฐานข้อมูล
$result = mysql_db_query ($dbname, $sql);
//ตรวจสอบการแก้ไขข้อมูล
if (!result) {
echo "<h2> "._ERRORADDNUMBER." </h2><br>";
}
else {
echo "<center><b>"._ADDCOMPLETED." </b></center>";
}
mysql_close;
?>
<CENTER>
<br><br>
<B>| <a href="javascript:window.close();"> x <?echo ""._CLOSEWINDOW."";?> x </a> | <a href="add.php"><?echo ""._ADDAGAIN."";?></a> |</B></CENTER>
</body>
</html>
Tag : PHP, MySQL
Date :
2012-10-09 15:36:04
By :
นนท์
View :
1147
Reply :
1
Warning: copy(yala2012.jpg) [function.copy]: failed to open stream: No such file or directory in C:\AppServ\www\telephone\addtel.php on line 43
ระบบมันแจ้งว่าไม่มีโฟลเดอร์ที่คุณจะจัดเก็บไฟล์ที่อัพโหลดครับ ลองเช็คพาทของโฟลเดอร์ที่เก็บไฟล์ครับว่ามีอยู่จริงหรือเปล่า? น่าจะโค้ดบรรทัดนี้ครับ
if (!copy($userfile, $directory.$userfile_name)) {
print("failed to copy $userfile <br>\n");
}
เช็คว่า ตัวแปรเหล่านี้เก็บค่าอะไรอยู่ ตรงตามที่ต้องการรึเปล่า?
$userfile = ?
$directory = ?
$userfile_name = ?
Date :
2012-10-09 16:50:01
By :
arm8957
Load balance : Server 03