Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > นอกจากคำสั่ง @unlinkแล้วมีคำสั่งตัวไหนอีกบ้างครับที่จะลบไฟล์ที่อัพออกจากโฟนเดอร์



 

นอกจากคำสั่ง @unlinkแล้วมีคำสั่งตัวไหนอีกบ้างครับที่จะลบไฟล์ที่อัพออกจากโฟนเดอร์

 



Topic : 033437



โพสกระทู้ ( 37 )
บทความ ( 0 )



สถานะออฟไลน์




นอกจากคำสั่ง @unlinkแล้วมีคำสั่งตัวไหนอีกบ้างครับที่จะลบไฟล์ที่อัพออกจากโฟนเดอร์ของเรา คือผมอัพไฟล์พวก.docนะครับ เวลาลบเรคคอร์ดก็อยากให้ลบไฟล์ที่อัพด้วยนะครับ
ช่วยหน่อยนะครับนั่งสามวันติดแล้ว



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2009-10-24 00:41:55 By : somsak84 View : 1246 Reply : 6
 

 

No. 1



โพสกระทู้ ( 5,146 )
บทความ ( 26 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


unlink นี่หละครับ ชะงัีดแ่ล หายเกลี้ยง






Date : 2009-10-24 00:47:02 By : deawx
 


 

No. 2



โพสกระทู้ ( 37 )
บทความ ( 0 )



สถานะออฟไลน์


พี่ครับดูการใส่โค้ด unlink ของผมนะครับบันทัดที่52-53นะครับ,มันถูกปล่าว

Code (PHP)
<?php
session_start();
include("../../Includes/PortalConection.php");
include("../../Includes/Database.php");

$strRootpath= "../../";
include_once ("../../Includes/validsession.php");
//$strsql = "SELECT  FROM news_t_newsdetails ";
//	$strsql.= " WHERE id=" .SQLSafeString($tempfile);
//	$objQuery = mysql_query($tempfile) or die (mysql_error());
//	$objResult = mysql_fetch_array($objQuery);
//	if($objResult)
//	{
//		if($objResult["tempfile"]!="")
//		{
//			@unlink("./filedata/".$objResult["tempfile"]);
//		}
//		}
if (!isset($_GET['action']))
{
	$strAction="";
}
else
{
	$strAction =QuerySafeString($_GET["action"]);
}

$conclass =new DataBase();
$strErrorMessages="";

if ($strAction=="DEL")
{
	$strID= QuerySafeString($_GET["ID"]);

	if (!isset($_GET['View']))
	{
		$strView="Active";
	}
	else
	{
		$strView= QuerySafeString($_GET["View"]);
	}
	if (($strID!="") && ($strID!="0"))
	{
	
		$strsql="DELETE FROM news_t_newsdetails ";
		$strsql.= " WHERE id=" .SQLSafeString($strID);
		$var1=$conclass->Execute ($strsql,$strErrorMessages);
		if ($strErrorMessages!="")
		{
			$strErrorMessages = "Could not delete the news information. " .$strErrorMessages;
			}else
             unlink(".filedata/file_name"); // คำสั่งลบไฟล์
			//@unlink("./filedata/"["tempfile"]);
//			unlink("Admin/News/filedata/"); // คำสั่งลบไฟล์
		}
	}
else
{
	$strID= QuerySafeString(strtoupper($_REQUEST["txtID"]));
	$strTitle= QuerySafeString($_REQUEST["txtTitle"]);
	$strNewsDescription= NewLineinHTML(QuerySafeString($_REQUEST["txtNews"]));
	$strNewsDate=QuerySafeString($_REQUEST["txtNewsDate"]);
	$strExpireDate=QuerySafeString($_REQUEST["txtExpireDate"]);
	
	
	$strActive=QuerySafeString($_REQUEST["txtActive"]);
	$strView= QuerySafeString($_REQUEST["txtView"]);

	if ($strActive=="")
		{
		$strActive="N";
		}
		
	if (($strID !="") && ($strID!="0"))
	{
		$strsql="UPDATE news_t_newsdetails SET title='" . SQLSafeString($strTitle) ;
		$strsql.=		"',newsdescription ='" . SQLSafeString($strNewsDescription) ;
		$strsql.=		"',newsdate ='" . DateFormatMysql($strNewsDate) ;
		$strsql.=		"',expirydate ='" . DateFormatMysql($strExpireDate) ;
		$strsql.=		"',active='" . SQLSafeString($strActive);

		$strsql.= "' WHERE id=" . SQLSafeString($strID);
		$var1=$conclass->Execute ($strsql,$strErrorMessages);
		if ($strErrorMessages!="")
		{
			$strErrorMessages = "Could not update the news information. " . $strErrorMessages;
		}
	}
	else
	{
	$strsql= "INSERT INTO news_t_newsdetails(title,newsdescription,newsdate,expirydate,active";
	$strTemp= " VALUES('" . SQLSafeString($strTitle) .  "','" . SQLSafeString($strNewsDescription) .  "','" ;
	$strTemp.=			DateFormatMysql($strNewsDate) . "','" . DateFormatMysql($strExpireDate) . "','" ;
	$strTemp.=			SQLSafeString($strActive) . "'";
	$strsql.= ") " . $strTemp . ")";
	$var1=$conclass->Execute ($strsql,$strErrorMessages);
		if ($strErrorMessages!="")
		{	$strErrorMessages = "Could not add the news. <BR>" . $strErrorMessages;}
		

	}
}

if ($strErrorMessages=="")
{	
	Redirect("List.php?View=" . $strView);
}
print "<HTML><HEAD>";
include ("../../Includes/Styles.php");
print "</HEAD><BODY>";
print "<TABLE border=0>";
print "<TR><TD WIDTH=15% VALIGN=TOP>";
include_once ("../../menulist.php");
print "</TD><TD>";

print $strErrorMessages;
?>
<P>&nbsp;</P>
<A HREF="List.php?View=<?php print $strView;?>"> Back to List</A>
<?php
print "</TD></TR>";
print "</TABLE>";
?>

</BODY>
</HTML>


Date : 2009-10-24 00:57:23 By : somsak84
 

 

No. 3



โพสกระทู้ ( 5,146 )
บทความ ( 26 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


คำสั่ง unlink มันต้องระบุพาธไฟล์ด้วยครับ

$filedelete = "mylove.jpg";
unlink($myFile);

หรือ

unlink("../pics/mylove.jpg");

ระบุพาธให้ถูกต้อง ตรงชื่อไฟล์ ต้องมีสามสกุลด้วย หรือเรียกมาจากฐานข้อมูล
เราต้องเรียกชื่อไฟล์มาจากฐานข้อมูลก่อนว่า ชื่อไฟล์มันชื่ออะไร แล้วค่อยใส่ตรงไฟล์พาธให้ถูกต้องน่ะครับ
$myfile = $r['mypicture'];
unlink("../pics/$myfile");

ดูตัวอย่างที่ http://th.php.net/manual/en/function.unlink.php ครับผม
Date : 2009-10-24 05:58:30 By : deawx
 


 

No. 4



โพสกระทู้ ( 37 )
บทความ ( 0 )



สถานะออฟไลน์


พี่ครับแล้วถ้า sql ผมเป็นตาราง news_t_newsdetails เก็บพาทไฟล์ไว้ที่ newsdescription

จะเพิ่มคำสั่ง unlink ยังไงอะครับ


พี่ปลากริมและพี่ p@e ช่วยหน่อยนะครับ
Date : 2009-10-24 15:39:32 By : somsak84
 


 

No. 5



โพสกระทู้ ( 37 )
บทความ ( 0 )



สถานะออฟไลน์


พี่ครับแล้วถ้า sql ผมเป็นตาราง news_t_newsdetails เก็บพาทไฟล์ไว้ที่ newsdescription

จะเพิ่มคำสั่ง unlink ยังไงอะครับ


พี่ปลากริมและพี่ p@e ช่วยหน่อยนะครับ
Date : 2009-10-26 22:43:22 By : somsak84
 


 

No. 6



โพสกระทู้ ( 37 )
บทความ ( 0 )



สถานะออฟไลน์


Code (PHP)
<?php
<?php
session_start();
include("../../Includes/PortalConection.php");
include("../../Includes/Database.php");

$strRootpath= "../../";
include_once ("../../Includes/validsession.php");

if (!isset($_GET['action']))
{
	$strAction="";
}
else
{
	$strAction =QuerySafeString($_GET["action"]);
}

$conclass =new DataBase();
$strErrorMessages="";

if ($strAction=="DEL")
{
	$strID= QuerySafeString($_GET["ID"]);

	if (!isset($_GET['View']))
	{
		$strView="Active";
	}
	else
	{
		$strView= QuerySafeString($_GET["View"]);
	}
	if (($strID!="") && ($strID!="0"))
	{
	$strSQL = "SELECT * FROM news_t_newsdetails ";
$strSQL .= "WHERE newsdescription='".$_GET["newsdescription"]."' ";
	$objQuery = mysql_query($strSQL) or die (mysql_error());
	$objResult = mysql_fetch_array($objQuery);
	if($objResult)
	{
		if($objResult["files"]!="")
		{
			unlink("filedata/".$objResult["files"]);
		}
		}
		$strsql="DELETE FROM news_t_newsdetails ";
		$strsql.= " WHERE id=" .SQLSafeString($strID);
		$var1=$conclass->Execute ($strsql,$strErrorMessages);
		if ($strErrorMessages!="")
		{
			$strErrorMessages = "Could not delete the news information. " .$strErrorMessages;
			}
		}		
	}
	else
{

	$strID= QuerySafeString(strtoupper($_REQUEST["txtID"]));
	$strTitle= QuerySafeString($_REQUEST["txtTitle"]);
	$strNewsDescription= NewLineinHTML(QuerySafeString($_REQUEST["txtNews"]));
	$strNewsDate=QuerySafeString($_REQUEST["txtNewsDate"]);
	$strExpireDate=QuerySafeString($_REQUEST["txtExpireDate"]);
	
	
	$strActive=QuerySafeString($_REQUEST["txtActive"]);
	$strView= QuerySafeString($_REQUEST["txtView"]);

	if ($strActive=="")
		{
		$strActive="N";
		}
		
	if (($strID !="") && ($strID!="0"))
	{
		$strsql="UPDATE news_t_newsdetails SET title='" . SQLSafeString($strTitle) ;
		$strsql.=		"',newsdescription ='" . SQLSafeString($strNewsDescription) ;
		$strsql.=		"',newsdate ='" . DateFormatMysql($strNewsDate) ;
		$strsql.=		"',expirydate ='" . DateFormatMysql($strExpireDate) ;
		$strsql.=		"',active='" . SQLSafeString($strActive);

		$strsql.= "' WHERE id=" . SQLSafeString($strID);
		$var1=$conclass->Execute ($strsql,$strErrorMessages);
		if ($strErrorMessages!="")
		{
			$strErrorMessages = "Could not update the news information. " . $strErrorMessages;
		}
	}
	else
	{
	$strsql= "INSERT INTO news_t_newsdetails(title,newsdescription,newsdate,expirydate,active";
	$strTemp= " VALUES('" . SQLSafeString($strTitle) .  "','" . SQLSafeString($strNewsDescription) .  "','" ;
	$strTemp.=			DateFormatMysql($strNewsDate) . "','" . DateFormatMysql($strExpireDate) . "','" ;
	$strTemp.=			SQLSafeString($strActive) . "'";
	$strsql.= ") " . $strTemp . ")";
	$var1=$conclass->Execute ($strsql,$strErrorMessages);
		if ($strErrorMessages!="")
		{	$strErrorMessages = "Could not add the news. <BR>" . $strErrorMessages;}
		

	}
}

if ($strErrorMessages=="")
{	
	Redirect("List.php?View=" . $strView);
}
print "<HTML><HEAD>";
include ("../../Includes/Styles.php");
print "</HEAD><BODY>";
print "<TABLE border=0>";
print "<TR><TD WIDTH=15% VALIGN=TOP>";
include_once ("../../menulist.php");
print "</TD><TD>";

print $strErrorMessages;
?>
<P>&nbsp;</P>
<A HREF="List.php?View=<?php print $strView;?>"> Back to List</A>
<?php
print "</TD></TR>";
print "</TABLE>";
?>

</BODY>
</HTML>


Date : 2009-10-26 23:10:53 By : somsak84
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : นอกจากคำสั่ง @unlinkแล้วมีคำสั่งตัวไหนอีกบ้างครับที่จะลบไฟล์ที่อัพออกจากโฟนเดอร์
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่