In PHP We can do like this to view files inside a folder:
$dir = '/var/www/';
$files1 = scandir($dir, 1);
print_r($files1);
But I want $dir depends on user input on html front end, so user may get files inside folder they choose.
In PHP We can do like this to view files inside a folder:
$dir = '/var/www/';
$files1 = scandir($dir, 1);
print_r($files1);
But I want $dir depends on user input on html front end, so user may get files inside folder they choose.
Front End To accept the path you can use either input type="text" or input type="file"
<?php
if(isset($_REQUEST["dir_path"]))
{
$dir=$_REQUEST["dir_path"];//path specified in the html form
$files1 = scandir($dir, 1);
print_r($files1);
}
?>