Hello all,
i have a problem, i cannot delete a file from my server using php. i am using unlink() to delete the file, but its not posting the file name.
Now, the row gets deleted from mysql, but the file doesnt get deleted. it says that "unlink()" isnt working? When i hover over the "delete" button, i see the id and filename, then i guess its not getting passed through that. Please helpPHP Code:<?php
if($_REQUEST['action']=="del") {
$con = mysql_connect("localhost","root","") or die("sorry");
mysql_select_db("tblname", $con);
mysql_query("DELETE FROM db WHERE id={$_REQUEST['id']};");
// Here is the problem
$myfile = "file:////serverip/test/".$_REQUEST['filename']."";
unlink($myfile);
mysql_close($con);
?>
<?php
//more code
//the link
( mysql code)
<a onclick=\"return confirm('Are You Sure?');\" href='P&A.php?action=del&id=".$row['id']."&file=".$row['filename']."'>Delete</a>



Reply With Quote


Bookmarks