Jump to content


Photo

is_dir not working.


  • Please log in to reply
3 replies to this topic

#1 mandrill

mandrill
  • Members
  • Pip
  • Newbie
  • 7 posts

Posted 21 September 2006 - 05:47 PM

The is-dir function isn't recognising a directory. here's the code:
<?php

/* Keiths Gallery Project
Purpose: To dynamically list files and directories and display them as galleries on my website
Step one: define variables */
$rootdir="the/directory/i/want/read";
// Step two: generate array of subdirectories of the directory. These will be my galleries organised according to subject matter
$dh=opendir($rootdir);
while ($filename = readdir($dh))
	{
	$rootdircont[] = $filename;
	}
foreach($rootdircont as $image)
	{
	echo"$image";
	var_dump(is_dir($image));
	echo"</br>";
	}
echo"$</br>";
$counter = 0 ;
foreach ($rootdircont as $file)
	{
	if ( is_dir($file)) 
		{
		$counter ++ ;
		echo "$counter: $file</br>";
		$galarray[$counter] = $file;
		}
	}
/* test echo of above */
echo '</br>';
foreach ($galarray as $galdir)
{
	echo "$galdir</br>";
}
?>
here's the output:
.bool(true)
..bool(true)
atomfeedbtn.pngbool(false)
readme.txtbool(false)
43things.pngbool(false)
ap-search-go-btn.gifbool(false)
arthurbool(false)       <-------------- This is a directory but its not being recognised as one.
bc80x15gold.gifbool(false)
blogoramabutton.gifbool(false)
button_sm_1.gifbool(false)
deliciousbutt.pngbool(false)
firefox_80x15.pngbool(false)
goblink.gifbool(false)
icon_scotland_80x15.gifbool(false)
index.htmlbool(false)
lcabutton.pngbool(false)
onepointthreebanner.jpgbool(false)
popdexbtn.pngbool(false)
right2writebtn.pngbool(false)
rssfeedbtn.pngbool(false)
scotblogsbtn.gifbool(false)
Thumbs.dbbool(false)
ucrated.pngbool(false)
ucv12title.jpgbool(false)
wika-blogbtn.pngbool(false)
Cloud.pngbool(false)
button6.gifbool(false)
Dawn_Of_Skirmish_v1.6_AI_Mod_Install.exebool(false)
egobutton.pngbool(false)
searchbox-logo-126x32.gifbool(false)
zardozzbtn.pngbool(false)
logo_80x15.gifbool(false)
libertybutt.pngbool(false)
wp-logos-buttons.jpgbool(false)
wp-button-3.pngbool(false)
tn-tiny.gifbool(false)
$
1: .

Its probably something really stupid but I'd appreciate it if someone could point it out to me, cos I've been staring at it for hours and getting nowhere.
thanks


---------------------------------------------------
I can't affor to pwn,
do you think I could r3nt?
http://keithneilson.co.uk
---------------------------------------------------

#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 21 September 2006 - 05:56 PM

Do the webserver have read permissions to the folder? I am not sure if this could be it, but lets just check it.

#3 sasa

sasa
  • Staff Alumni
  • Advanced Member
  • 2,804 posts
  • LocationHrvatska

Posted 21 September 2006 - 06:10 PM

change[codevar_dump(is_dir($image));][/code]to[code]var_dump(is_dir($rootdir.'/'.$image));


#4 mandrill

mandrill
  • Members
  • Pip
  • Newbie
  • 7 posts

Posted 21 September 2006 - 09:06 PM

bingo sasa that did it thanks :)
---------------------------------------------------
I can't affor to pwn,
do you think I could r3nt?
http://keithneilson.co.uk
---------------------------------------------------




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users