Space for google add

A program to read directory name from user and display content of the directory in PHP.



 A program to read directory name from user and display content of the
directory.


a3seta2.html

<html>

<body>

<form method="post" action="a3seta2.php">

Enter directory name:

<input type="text" name="dname"><br>

<input type='submit' name='submit' value='submit'>

<input type='reset' name='reset' value='reset'>

</form>

</body>

</html>



a3seta2.php

<?php

$dir=$_POST['dname'];

if(is_dir($dir))

{

$dp=opendir($dir);


if($dp)

{

while($file=readdir($dp))

{

if($file!="." && $file!="..")

echo "<br> $file <br>";

}

}

closedir($dp);

}

else

echo "<br>Directory type error.<br> ";

?>


Post a Comment

0 Comments