|
|
|
update รูปไม่เข้าไปใน folder ทำไงดี รูปไม่แสดงอีกอ่ะ |
|
|
|
|
|
|
|
คือว่า update รูปภาพเเล้วมันไม่ยอมเข้าไปในโฟลเดอร์ที่ต้องการจะเก็บ พอบันทึกเสร็จ รูปก้อไม่ยอมขึ้น ทำยังไงดี ผู้รู้ช่วยตอบหน่อยน่ะ
Code (PHP)
<?
require('connect.php');
$pic_boolean = null;
$file_boolean = null;
$File_Images= "File_Images/";
$news_pic= $_FILES['news_pic']['name'];
if ($_FILES['news_pic']['tmp_name'] != "") // µÃǨÊͺÇèÒÁÕä¿ÅìÊè§ÁÒËÃ×ÍäÁè
{
if(strchr($_FILES['news_pic']['name'],".")==".JPG" || strchr($_FILES['news_pic']['name'],".")==".jpg" || strchr($_FILES['news_pic']['name'], ".")==".GIF" || strchr($_FILES['news_pic']['name'],".")==".gift")
{
copy($_FILES['news_pic']['tmp_name'],"$File_Images/$news_pic"); // Copy File äÇé·Õè Folder File
$pic_boolean = true;
echo "pic===true";
}
else
{
echo "ä¿Åì·ÕèÊè§ÁÒäÁèãªèä¿Åì .Gif áÅÐ .Jpg ¹Ð¤ÃѺ";
$pic_boolean = false;
echo "file===false";
}
}
$File_Documents = "File_Documents/";
$news_pdf = $_FILES['news_pdf']['name'];
if ($_FILES['news_pdf']['tmp_name'] != "") // µÃǨÊͺÇèÒÁÕä¿ÅìÊè§ÁÒËÃ×ÍäÁè
{
if(strchr($_FILES['news_pdf']['name'],".")==".pdf" || strchr($_FILES['news_pdf']['name'],".")==".doc" || strchr($_FILES['news_pdf']['name'] ,".")==".ppt" || strchr($_FILES['news_pdf']['name'],".")==".txt" || strchr($_FILES['news_pdf']['name'],".")==".docx" || strchr($_FILES[
'news_pdf']['name'],".")==".pptx")
{
copy($_FILES['news_pdf']['tmp_name'],"$File_Documents/$news_pdf"); // Copy File äÇé·Õè Folder File
$file_boolean = true;
//echo "file===true";
} else
{
echo "ä¿Åì·ÕèÊè§ÁÒäÁèãªèä¿Åì .pdf , .doc , .docx , .ppt , .pptx , .txt ¹Ð¤ÃѺ";
$file_boolean = false;
//echo "file===false";
}
}
$File_Images = $File_Images.$news_pic;
$File_Documents=$File_Documents.$news_pdf;
$news_id = $_GET[news_id];
$news_topic = $_POST[news_topic];
$news_mes = $_POST[news_mes];
$news_start = $_POST[exampleI];
$news_time = $_POST[news_time];
$strSQL = "UPDATE news SET ";
$strSQL .="news_topic = '$news_topic' ";
$strSQL .=",news_mes = '$news_mes' ";
$strSQL .=",news_pic = '$news_pic' ";
$strSQL .=",news_pdf = '$File_Documents' ";
$strSQL .=",news_start = '$news_start' ";
$strSQL .=",news_time = '$news_time' ";
$strSQL .="WHERE news_id = '$news_id' ";
$objQuery = mssql_query($strSQL);
echo $strSQL;
if($objQuery)
{
echo "Save Done";
}
else
{
echo "Error Save [".$strSQL."]";
}
mssql_close($objConnect);
?>
Tag : PHP, MySQL, Ms SQL Server 2005, Ms SQL Server 2008, HTML/CSS
|
|
|
|
|
|
Date :
2011-04-18 12:12:07 |
By :
silfareal |
View :
1051 |
Reply :
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผิดอันค่ะ ต้องอันนี้
Code (PHP)
<?
require('connect.php');
$pic_boolean = null;
$file_boolean = null;
$File_Images= "File_Images/";
$news_pic= $_FILES['news_pic']['name'];
if ($_FILES['news_pic']['tmp_name'] != "") // ตรวจสอบว่ามีไฟล์ส่งมาหรือไม่
{
if(strchr($_FILES['news_pic']['name'],".")==".JPG" || strchr($_FILES['news_pic']['name'],".")==".jpg" || strchr($_FILES['news_pic']['name'], ".")==".GIF" || strchr($_FILES['news_pic']['name'],".")==".gift")
{
copy($_FILES['news_pic']['tmp_name'],"$File_Images/$news_pic"); // Copy File ไว้ที่ Folder File
$pic_boolean = true;
echo "pic===true";
}
else
{
echo "ไฟล์ที่ส่งมาไม่ใช่ไฟล์ .Gif และ .Jpg นะครับ";
$pic_boolean = false;
echo "file===false";
}
}
$File_Documents = "File_Documents/";
$news_pdf = $_FILES['news_pdf']['name'];
if ($_FILES['news_pdf']['tmp_name'] != "") // ตรวจสอบว่ามีไฟล์ส่งมาหรือไม่
{
if(strchr($_FILES['news_pdf']['name'],".")==".pdf" || strchr($_FILES['news_pdf']['name'],".")==".doc" || strchr($_FILES['news_pdf']['name'] ,".")==".ppt" || strchr($_FILES['news_pdf']['name'],".")==".txt" || strchr($_FILES['news_pdf']['name'],".")==".docx" || strchr($_FILES[
'news_pdf']['name'],".")==".pptx")
{
copy($_FILES['news_pdf']['tmp_name'],"$File_Documents/$news_pdf"); // Copy File ไว้ที่ Folder File
$file_boolean = true;
//echo "file===true";
} else
{
echo "ไฟล์ที่ส่งมาไม่ใช่ไฟล์ .pdf , .doc , .docx , .ppt , .pptx , .txt นะครับ";
$file_boolean = false;
//echo "file===false";
}
}
$news_id = $_GET[news_id];
$news_topic = $_POST[news_topic];
$news_mes = $_POST[news_mes];
$news_start = $_POST[exampleI];
$news_time = $_POST[news_time];
$news_pic = $_POST[news_pic];
$File_Images = $File_Images.$news_pic;
$File_Documents=$File_Documents.$news_pdf;
$strSQL = "UPDATE news SET ";
$strSQL .="news_topic = '$news_topic' ";
$strSQL .=",news_mes = '$news_mes' ";
$strSQL .=",news_pic = '$File_Images' ";
$strSQL .=",news_pdf = '$File_Documents' ";
$strSQL .=",news_start = '$news_start' ";
$strSQL .=",news_time = '$news_time' ";
$strSQL .="WHERE news_id = '$news_id' ";
$objQuery = mssql_query($strSQL);
echo $strSQL;
if($objQuery)
{
echo "Save Done";
}
else
{
echo "Error Save [".$strSQL."]";
}
mssql_close($objConnect);
?>
|
|
|
|
|
Date :
2011-04-18 12:16:06 |
By :
silfareal |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
พอบันทึกเสร็จเเล้วมันก้อเป็นแแบบนี้อ่ะค่ะ
UPDATE news SET news_topic = 'fghh' ,news_mes = 'fdggdsgf ' ,news_pic = 'File_Images/C:\\Users\\ASUS\\Pictures\\act_carlos_arroyo.jpg' ,news_pdf = 'File_Documents/' ,news_start = '2011-04-18' ,news_time = '13:15' WHERE news_id = '124' Save Done
ตรง news_pic มันต้องเป็น 'File_Images/act_carlos_arroyo.jpg' แต่มันไม่เป็นอ่ะค่ะ ช่วยแก้ให้ที
|
|
|
|
|
Date :
2011-04-18 12:17:55 |
By :
silfareal |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แก้แล้วรูปภาพมันไม่บันทึกเลยค่ะ
|
|
|
|
|
Date :
2011-04-18 13:06:43 |
By :
silfareal |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ชาวยตอยหน่อยค่ะ
|
|
|
|
|
Date :
2011-04-18 19:08:23 |
By :
silfareal |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
บรรทัด 51 เปลี่ยนรึยัง
echo sql update ออกมาดูว่าหลังเปลี่ยนแล้วค่า sql เป็นยังไง
|
|
|
|
|
Date :
2011-04-18 21:14:47 |
By :
mr.v |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตอนนี้แก้ได้แล้วค่ะ ขอบคุณทุกคนที่ช่วยตอบน่ะค่ะ
|
|
|
|
|
Date :
2011-04-18 21:18:26 |
By :
silfareal |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|