Running PHP on a Linux box
I'm trying to write a script to delete files and records that have been uploaded by users.
I can get the record itself to delete; however, I am not sure how to get the file deleted from the uploaded folder.
Script I'm using so far:
<?php
// Set up error reporting display
ini_set('display_errors', 1);
error_reporting(E_ALL);
include_once('db_fns.php');
$handle = db_connect();
$file = $_REQUEST['file'];
$query = "delete from uploads where id = $file";
$result = $handle->query($query);
unlink ($file);
header('Location: '.$_SERVER['HTTP_REFERER']);
?>
I thought the unlink() would work; yet, it's not. No errors at all.
The record's getting deleted just not the file itself.