im working on PhpNuke
i made a folder uploads/audio/
and within that folder i uploaded some files of .mp3 etc
now i need to delete those files using the php code
im trying to delete them with the following code but its not working:
unlink("uploads/audio/somefile.mp3");
but file is not being deleted. urgent help needed, please.
-Waqar
file delete code not working - i'm using PhpNuke
Moderator: General Moderators
here's my code, please help, file not being deleted...
patrikG | Please use
patrikG | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
here's my code, help required, i can't figure out why the file is not being deleted.
besides this, im using EasyPHP on Windows XP, so if anyone knows how to check the files/folders permissions in it please let me know. however, please remember, the file.txt is deleted if its not in a folder, but if it is in a folder, im unable to to delete it.Code: Select all
case "deleteaudio":
if($_REQUEST['id']!=NULL)
{
//QUERY TO SELECT AND DELETE THE FILE FROM THE SERVER (LOCATION)
$sql = "SELECT location FROM ".$prefix."_audio WHERE id=".$_REQUEST['id'];
$result = $db->sql_query($sql);
// row[location] variable is actualy the path and filename which is stored in database, so you can assume it
// to be folder1/folder2/file.txt
echo $row[location];
//DELETING (UNLINKING) THE FILE
if(unlink($row[location]))
{
echo "<p>File deleted from server, please wait ...</p>";
}
else
{
echo "<p>File NOT deleted from server location ...</p>";
}
//QUERY TO DELETE THE DETAILS OF THE AUDIO FILE FROM DATABASE
$sql="DELETE FROM ".$prefix."_audio WHERE id=".$_REQUEST['id'];
$db->sql_query($sql);
echo "<p>Audio successfully deleted from database ...</p>";
}
break;Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]