I threw together a page to allow me to delete (er. move) images from a directory
http://shores-rentals.com/rentals/delete_images.php?id=7#
Here’s the code,
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$dirname = "images/".$_GET['id']."/";
echo $dirname."<br>";echo $_POST;
foreach($_POST as $image){
if (copy($dirname.$image,$dirname.'bad'.$curimg)) {
unlink($dirname.$image);
}
}
}
?>
<form method="POST" action="#">
<fieldset>
<legend>All images inside <?=$_GET['id']?> directory</legend>
<?php
$dirname = "images/".$_GET['id']."/";
$images = scandir($dirname);
$ignore = Array(".", "..","bad","thumbs");
foreach($images as $curimg){
if(!in_array($curimg, $ignore)) {
echo "<input type='checkbox' value=".$curimg." style='height:200px' />";
echo "<img src=".$dirname.$curimg." style='height:200px' />\
";
}
}
?>
</fieldset>
<input type="submit" value="Move Images" />
</form>
im trying to loop through th $_POST and move the image.