Forum Moderators: coopster
I am looking to write a very basic script that will simply list the entire contents of a directory/folder and also put a little button/text next to each listed item in the dir/folder with the option to view and delete.
Basically I want it to look something like this
photo1.jpg....view ¦ delete
photo2.jpg....view ¦ delete
photo3.gif....view ¦ delete
photo4.png....view ¦ delete
you get the idea?
can anyone tell me first of all if this is possible and secondly how I might go about doing it or where I might look for inspiration?
Any help would be much appreciated
Thank you
EDIT:
opendir() [php.net] should show you everything you need. ;)
Your query to show the imgs will state "where published='$published' "; (default n, so you may publish and un-publish)
Two) if so (as above mentioned) A) un-publish by updating "published to "n"
and B) after a while if you really want to del it then go ahead
as far as listing from a dir, try this search [google.com], there are a bunch of threads that have snippets
<form method="post" action="test.php">
<select name="OS" SIZE=3>
<?
$dir = "/home/www/juttuffi/gallery/images";
$d = dir($dir);
$type = array('jpeg', 'jpg', 'gif', 'bmp', 'png');
while($entry = $d->read())
{
if ($entry!= "." && $entry!= ".." && array_search($type)!== false)
{
echo "<option>".$entry."</option>";
}
}
$d->close();
?>
</select>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
the array_search function in the above doesn't work but I am working on it.