Jump to content

Is_dir() Help!


syco

Recommended Posts

Ok I need help as to why it will not display the folders as folders when using is_dir()Actual page at http://pinyonline.com/index.php?page=Galleryclik photoorat http://pinyonline.com/index.php?page=Galle...p;section=Photo

<p><?if ($_GET['section']){$section = $_GET['section'];echo "<h2>$section</h2><br />";	$path = "/home/noobcrew/www/pinyonline.com/gallery/$section";if ($_GET['folder']){$folder = $_GET['folder'];	$path = "/home/noobcrew/www/pinyonline.com/gallery/$section/$folder";}	$dir_handle = @opendir($path) or die("No files yet!"); 	while ($file = readdir($dir_handle)) { 	if($file == "." || $file == ".." || $file == "index.php" ) 		continue; if (is_dir($file)) {		echo "<p>Folder: <a href='index.php?page=Gallery&section=$section&folder=$file'>$file</a><br /></p>";}else {		echo "<p>File: <a href='gallery/$section/$file' target='_blank'>$file</a><br /></p>";}	} 	closedir($dir_handle); }else {?><a href="index.php?page=Gallery&section=Photo"><img src="images/photo.gif" border="0"></a> <a href="index.php?page=Gallery&section=Video"><img src="images/video.gif" border="0"></a><a href="index.php?page=Gallery&section=EVP"><img src="images/evp.gif" border="0"></a> <a href="index.php?page=Gallery&section=Misc"><img src="images/misc.gif" border="0"></a><?php}?></p>

Link to comment
Share on other sites

is_dir() expects a pathname relative to the current working directory, which is probably the script location. You are passing it a filename only, not a complete path. From the looks of things, the file and the script are not in the same directory, so that won't work. Pass the full path.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...