I have the following code, and I appologize if the forum output makes the code look like garbage...
<?PHP
$filename = $files[$i];
if (strlen($filename)>43) {
$filename = substr($files[$i], 0, 40) . '...';
}
$fileurl = $leadon . $files[$i];
if ($forcedownloads) {
$fileurl = $_SESSION['PHP_SELF'] . '?dir=' . urlencode($leadon) . '&download=' . urlencode($files[$i]);
}
?>
<tr <?PHP echo $hover; ?> onClick="window.location='<?=$fileurl;?>'" class="<?PHP echo $class; ?>">
<td align="center" valign="top">
<table cellpadding="0" cellspacing="0" align="center" class="contentlinks">
<?PHP
if ($_GET['deletefile']) {
chmod("$filename", 0777);
unlink("$filename");
} else {
?>
<form method="post" action="<?=$_SERVER['PHP_SELF'];?>">
<tr <?=$thumb2;?>>
<td align="left" valign="middle" class="listing-a">
<div id="listing">
<div><img src="ssindexing/skins/plasticgreen/icons/<?=$icon;?>" border="0" alt="<?=$files[$i];?>" /><div id="listingtext"><?=$filename;?></div><?=$thumb;?></div>
</div>
</td>
<td align="center" valign="middle" class="listing-b">
<?=round(filesize($leadon.$files[$i])/1024);?>KB</td>
<td align="center" valign="middle" class="listing-c">
<?=date ("M d Y h:i:s A", filemtime($leadon.$files[$i]));?></td>
<td align="center" valign="middle" class="listing-d">
<input type="submit" class="delete" name="deletefile" value="Delete" /></td>
</tr>
</form>
<?PHP
}
?>
</table>
</td>
</tr>
I have it chmoding the files to 0777 so they can be deleted via the unlink command. But for some reason it wont delete.
Does anyone know why I can't get the files to delete?
