cooldude832 Posted December 12, 2007 Share Posted December 12, 2007 http://us2.php.net/manual/en/function.unlink.php Just be careful with it Link to comment https://forums.phpfreaks.com/topic/81157-solved-display-all-items-in-a-directory/page/2/#findComment-412891 Share on other sites More sharing options...
adam291086 Posted December 12, 2007 Author Share Posted December 12, 2007 i know about unlink, currently reading and already used. But how would i use it within my script with a link. Just can't get my head around it. Link to comment https://forums.phpfreaks.com/topic/81157-solved-display-all-items-in-a-directory/page/2/#findComment-412893 Share on other sites More sharing options...
cooldude832 Posted December 12, 2007 Share Posted December 12, 2007 [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] Link to comment https://forums.phpfreaks.com/topic/81157-solved-display-all-items-in-a-directory/page/2/#findComment-412896 Share on other sites More sharing options...
adam291086 Posted December 12, 2007 Author Share Posted December 12, 2007 Thanks a lot cooldude. Link to comment https://forums.phpfreaks.com/topic/81157-solved-display-all-items-in-a-directory/page/2/#findComment-412898 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.