Alright, so I attempted the array approach but it still is not working.
Here is my array, I will show you the error I get afterwards:
$file1=$row["u_file5_name"];
$file2=$row["u_file6_name"];
$file3=$row["u_file7_name"];
$username=$_SESSION['username'];
//array for file deletion
$xfiles = array( $file1, $file2, $file3);
for ($i=1;$i<count($xfiles);$i++)
{
if($xfiles[$i]) //delete actual file if it exists
{
$loser[$i] = "../../_user_upload/".$username."/".$xfiles[$i];
unlink($loser[$i]);
}
}
There is my code, and the error message says this:
Warning: unlink() failed (Is a directory) in /var/www/members/upload/upload_remove_all.php on line 224
Warning: unlink() failed (Is a directory) in /var/www/members/upload/upload_remove_all.php on line 224
Warning: unlink() failed (Is a directory) in /var/www/members/upload/upload_remove_all.php on line 224
It says it three times, meaning the unlink failed all three times. I am pretty sure the problem lies in the last segment of the line with /".$xfiles[$i];
It is trying to delete the directory instead of a specific file.
Thanks in advance!
-influx