A smal php script for a page to overview and remove files from you upload folder. If someone wants it?
if (!isset($_GET['folder']))
$_GET['folder']="image";
/**********************************************************************************/
if(isset($_POST['tabort'])){
extract($_POST);
//path to you uploadfolder
$filen='../uploads/'.$fold.'/'.$file.'';
if (file_exists($filen)){
chmod($filen,0777);
unlink($filen);
$message=$file." removed";
}
else
{
$message="There was no file by that name";
}
unset($_POST);
}
/**********************************************************************************/
echo'
<h1>Cleanup in your files</h1>
<div style="text-align:center; padding:10px;">
<a href="cleanupload.php?folder=image">Images</a> | <a href="cleanupload.php?folder=file">Files</a> | <a href="cleanupload.php?folder=flash">Flash</a> | <a href="cleanupload.php?folder=media">Media</a>
</div>
<h1>Files</h1>
<div style="clear: both; font-weight: bold; border-bottom: 1px solid #B4B7AA; height: 20px; width: 500px; margin-left:100px;">
<div style="float: left; width: 400px;">Filename</div>
<div style="float: right; margin-right:10px;">Remove</div>
</div>
';
//path to files
$dirname = "../uploads/".$_GET['folder']."/";
if ($dir = opendir($dirname)) {
while(false !== ($file = readdir($dir))) {
if(($file != ".") and ($file != "..")) {
echo'<form name="files" method="post" action="cleanupload.php" style="disply:inline;">
<div style="clear: both; border-bottom: 1px solid #B4B7AA; height: 20px; width: 500px; margin-left:100px;">
<div style="float: left; width:400px;">'.$file.'</div>
<div style="float: right;"><input type="submit" name="tabort" value="Remove" style="font-size: 80%; margin:1px 10px 0 0; padding:1px 8px 1px 8px; border:1px solid;"></div>
</div>
<input name="file" type="hidden" value="'.$file.'" />
<input name="fold" type="hidden" value="'.$_GET["folder"].'" />
</form>
';
}
}
closedir($dir);
} else {
echo "Kan inte öppna: $dirname<br>";
} 