Hi all, here i got a problem where i want to delete file uploaded..my script
just remove from database but not remove from directory.. how can i delete from database and directory at a same time?? Please help me..

this my delete code

include 'connection/db_connect.php';
$attcid = $_GET['attcid'];
$username = $_GET['username'];

$sql="DELETE FROM attachment WHERE attcid = '$attcid'";


try.. make sure the directory and the file name are properly assigned below.

if (file_exists($attcid."whatever.extensionOfFile"){
						@unlink($attcid."whatever.extensionOfFile") ;

echo "Are you kidding me? This file don't even exist. I already looked.";

commented: Useful post +6

thanks veedeoo for suggestion..still not work.. hurm.. :(

unlink works, if it doesn't then there's problem with your path, if you doubt it's functionality, try doing simple test, like unlink(test.php); putting unlink script and test.php into the same directory

thanks all!! it works!! when second try i change by calling the file name.. hurmm
thank you so much!! This my latest code.. :)

$sql="DELETE FROM attachment WHERE fileName = '$fileName'";