Code: Alles auswählen
<?
// Datein Löschen
if($_GET["loechen"]==1 AND $_GET["file"]!=''){
if(file_exists($_GET["file"])==true){
if(@unlink($_GET["file"])==true) echo '<div style="color:green;">Die Datei wurde erfolgreich gelöscht!<br><br></div>';
else echo '<div style="color:red;">Die Datei konnte nicht gelöscht werden.<br><br></div>';
} else {
echo '<div style="color:red;">Die Datei gibt es nicht im Upload Verzeichnis!<br><br></div>';
}
}
?>
<table border="0" bordercolor="Gray" bgcolor="DarkGray" cellspacing="2" cellpadding="2" width="500">
<tr align="middle" bgcolor="Gainsboro" style="font-weight:bold">
<td><SPAN class="fett">File</SPAN></td>
<td><SPAN class="fett">Größe</SPAN></td>
<td><SPAN class="fett">Letzte Änderung</SPAN></td>
<td><SPAN class="fett">Aktion</SPAN></td>
</tr>
<?
// Datein Verzeichnis ansgeben
$i=0;
$verz=opendir ($img_path_up);
while (false !== ($file = readdir($verz))) {
if ($HTTP_POST_FILES['userfile']['tmp_name']<> 'none'){
$file = $HTTP_POST_FILES['userfile']['name'];
$temp = $HTTP_POST_FILES['userfile']['tmp_name'];
$path_parts = pathinfo($file);
$filename = "datei_" . time() . "." . $path_parts["extension"];
if (filetype($img_path_up.$file)!="dir"){
$i++;
echo '<tr bgcolor="Gainsboro">';
echo ' <td><a href="http://'.$_SERVER['HTTP_HOST'].$path.$file.'" target="_blank">'.$file.'</a></td>';
echo ' <td>'.fs_convert($img_path_up.$file,2).'</td>';
echo ' <td>'.date("d.m.Y H:i", last_change($img_path_up.$file)).'</td>';
echo ' <td><a href="'.$_SERVER["PHP_SELF"].'?file='.$img_path_up.$file.'&loechen=1" >Löschen</td>';
echo '</tr>';
}
}
if($i==0){
echo '<tr bgcolor="Gainsboro">';
echo ' <td colspan="4">Es ist noch keine Datei im Upload Ordner.</td>';
echo '</tr>';
}
closedir($verz);
?>
Wenn ich den code so verwenden möchte habe ich 2 fehler im Browser stehen einmal
Warning: readdir(): supplied argument is not a valid Directory resource in /var/www/web7/html/admin.php on line 54
Und das is der andere
Warning: closedir(): supplied argument is not a valid Directory resource in /var/www/web7/html/admin.php on line 71
Kann mir jemand helfen?Was fehlt in dem code??