I'm looking for a way to delete a file from the server using PHP. Basically I have my files listed on a page in this manner:
<ul>
<li><a href="delete_file.php?file=uploads/file_01.jpg">Delete File 01</a></li>
<li><a href="delete_file.php?file=uploads/file_02.jpg">Delete File 02</a></li>
<li><a href="delete_file.php?file=uploads/file_03.jpg">Delete File 03</a></li>
</ul>
The problem is I'm not sure how to get my delete_file.php file to work. I believe it needs to be something like this:
<?php
$path="uploads/file_01.jpg";
if(unlink($path)) echo "File Deleted";
?>
...but I'm not sure how to get the $path to change to the file I had clicked on to delete.