Monday, May 18, 2015

Find out all files of a directory with function in php


In this topics we'll discus on "how to find out all files of a directory of web server". It will give you knowledge about working with files.



We will create a simple function to find out files of a directory.

function files()
{
$path = './uploads/';
$prefix='x';
if ($handle = opendir($path)) {
var_dump(opendir($path));
   while (false !== ($file = readdir($handle))) {
    echo $file.'<br/>';         }
   }
}
}
After write this simple function now we can call this function as follow-
files();
Now see it show a list of files name.

0 comments :

Post a Comment

 

Copyright @ 2014 Tech Tutorial .