rendered paste body<?php$file_dir="images";if(!isset($action)){ $dir=opendir($file_dir); while ($file=readdir($dir)) { if ($file != "." && $file != "..") { echo "<a href=".$file_dir."/".$file." target=_blank>".$file."</a>";}else if ($action == "edit"){ $fp=fopen($file, "a+"); echo "<form action = ".$_SERVER['PHP_SELF']."?action=update&file=".$file." method = post><textarea rows=20 cols=60 name = newcontent></textarea><br><input type = submit value = Update></form>"; fclose($fp);}else if($action == "update"){ $fp=fopen($file, "w"); $new_content=$_POST['newcontent']; rename( '$file', 'newcontent' ); fclose($fp); echo "Updated successfully.<br><br><a href=".$_SERVER['PHP_SELF'].">Return</a>";}?>