Hi,
I am trying to do a string manipulation from the name of the files that I have in a certain directory.
Until now, I have successfully listed down all the files in that directory.
However, I still need these file names for string manipulation that I just mention.
Below is my code:
if ($handle = opendir('user\cfile\\'))
{
//loop over directory
while (false !== ($file = readdir($handle)))
{
//eliminate unnecessary file
if ($file != ".." && $file != ".")
{
//echo "<a href=scriptedit.php?path=.&filename=$file>$file</a><br>";
echo $file."<br>";
}
}
closedir($handle);
}
Rightnow, I can produce this in the web
test1.html
test2.html
test3.html
I need to get all of these file names which right now contain in $file and do some string manipulation. One method that comes to my mind is storing $file in a variable. Then use session to pass that variable to another file.
How can I do this? or are there any better way to do get the file names?
Thanks in advance