hi i'm trying to display the files and folders but it seems like the
urlencode() function is not working. can some body plz help.
thank you in advance
here is the code
/ **
Filename: booklist.php ****
*/
include("$DOCUMENT_ROOT/fn/dir/listdir.php"); //function returns directories as an array
include("$DOCUMENT_ROOT/fn/dir/listfile.php"); //function return files as an array
if(!isset($dir_start_loc))
{
$dir_start_loc = "$DOCUMENT_ROOT/books";
}
$dir = list_dir($dir_start_loc);
$files = list_file($dir_start_loc); //list the files
for($dir_index=0; $dir_index<count($dir); $dir_index++)
{
$dirname = urlencode($dir[$dir_index]);
$tmploc = "$dir_start_loc/$dirname";
echo "<a href=booklist.php?dir_start_loc=$tmploc>$dir[$dir_index]</a> <br>";
}
for($file_index=0; $file_index<count($files); $file_index++)
{
$filename= urlencode($files[$file_index]);
$filename = "$dir_start_loc/$filename";
$filename = str_replace("$DOCUMENT_ROOT/books/", "", $filename);
echo "<a href=$filename>$files[$file_index]</a> <br>";
}