Jump to content

[SOLVED] Display all items in a directory


adam291086

Recommended Posts

[code]
<?php
$ImageDirectory = "../upload/pictures/thumbnail";
echo "<form action=\"delete.php\" method=\"post\">
foreach (glob("$ImageDirectory/{*.gif,*.jpg,*.png,*.GIF,*.JPG,*.PNG}", GLOB_BRACE) as $image)
{
$path = str_replace($_SERVER['DOCUMENT_ROOT'],"",$image);
echo '<br />';
echo $fullname;
echo '<br />';
echo "<input type=\"check\" name=\"delete[".$image."]\" value=\"1\" />";
echo '<img src="'.$image.'">';
echo '<br />';
echo $path;
echo '<br />';
}
echo "</form>";
?>

 

Then on the delete page its very simple


<?php
foreach($_POST['delete'] as $key => $value){
if($value == "1"){
unlink($key);
}
}
?>

[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.