Hello,
I have written some code that displays a list the contents of a directory on the server. The user places a checkmark next to the file(s) to be deleted.
Then when the user clicks the “Delete Selected Files” button my php code (below) loops through an array of the selected files. However, it is not working properly.
I checked the permissions on the folder - rwx rwx rwx.
Any help would be appreciated.
<?php
$iTotal = $_POST[‘Final’];
$sArray = $_POST[‘Files’];
$iTemp = count($sArray);
$sPath = “/bluebusiness/FileUploads/”;
print (“You selected to delete $iTemp File(s)<br><br>”);
if ($iTotal > 0)
{
for ($iCount = 0; $iCount < $iTotal; $iCount++)
{
$sFile = $sPath . $sArray[$iCount];
if ( $sArray[$iCount] != '')
{
print ("$sFile <br>");
if (is_file("$sFile"))
{
unlink("$sFile");
}
}
}
}