troubleshooting Question

delete file from server

Avatar of nascent1
nascent1Flag for Canada asked on
12 Comments1 Solution385 ViewsLast Modified:
The attached code removes the entry from the db correctly, but does not delete the file from the directory. The "URL" path is correctly stored in the db and the directory the file is stored in is set with permissions to 777. How do I make it so the file is deleted from the directory?
if(isset( $_SESSION['diradmin']))
      $get_file = mysql_query("SELECT URL FROM cms_medlinks_entries WHERE id=".$id);
      list($del_path) = mysql_fetch_row($get_file);
    $deletefile="DELETE from cms_medlinks_entries where id='$id'";
    mysql_query($deletefile) or die("Could not delete file");
	print "Entry Deleted";
	   else if(isset($_GET['id']))
    print "<form action='deletefile.php' method='post' id='default' class='box'>";
    print "Are you sure you want to delete this listing?<br>";
    print "<input type='hidden' name='id' value='$id'>";
    print "<input type='submit' name='submit' value='delete' class='submit'>";
	print "<a class='button' href=\"" . $_SERVER['HTTP_REFERER'] . "\">do NOT delete</a>";
print "</form>";
  $result = mysql_query ($query);
if (! $result) Header("Location: $site/admin/login.php");
// else proceed
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 12 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros