Forum Moderators: coopster

Message Too Old, No Replies

directory files shown problem

         

fenomen

9:49 am on Sep 22, 2005 (gmt 0)

10+ Year Member



i have a function that it showes files in an directory.

<?
$dizin_adi = "./klasor";
$dizin = opendir ($dizin_adi);
while ( gettype ( $bilgi = readdir( $dizin ) )!= @boolean ) {
if ( is_file( "$dizin_adi/$bilgi" ) )
echo "<option value=\"$dizin_adi/$bilgi\">".$bilgi."</option>";
}
closedir ($dizin);
//
?>

this function is true. it's working.
but i want to show an upper directory files. now it showes (www.domain.com/klasor/...) but i want to show (www.domain.com/...).

i tried some variations. for example ($dizin_adi = "./klasor";) ($dizin_adi = "../klasor";) ($dizin_adi = "./../klasor";) ($dizin_adi = "/klasor";)

but i doesn't work.

so what am i change in this code?

Birdman

12:28 pm on Sep 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You may want to try this:

$dizin_adi = $_SERVER['DOCUMENT_ROOT'];

Hope it helps.

BTW, welcome to WebmasterWorld!

fenomen

7:04 pm on Sep 22, 2005 (gmt 0)

10+ Year Member



but directory is not on ROOT. it is on one lower directory. for example:

my files takes place here:
[domain.com...]

i want to it lists an upper directory. (dir1)
[domain.com...]

Birdman

11:21 am on Sep 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ah...I see. Just add the dir to the line I gave and it should work ok:

$dizin_adi = $_SERVER['DOCUMENT_ROOT'] . '/dir1';