syco Posted March 4, 2010 Share Posted March 4, 2010 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§ion=$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§ion=Photo"><img src="images/photo.gif" border="0"></a> <a href="index.php?page=Gallery§ion=Video"><img src="images/video.gif" border="0"></a><a href="index.php?page=Gallery§ion=EVP"><img src="images/evp.gif" border="0"></a> <a href="index.php?page=Gallery§ion=Misc"><img src="images/misc.gif" border="0"></a><?php}?></p> Link to comment Share on other sites More sharing options...
jeffman Posted March 4, 2010 Share Posted March 4, 2010 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 More sharing options...
syco Posted March 4, 2010 Author Share Posted March 4, 2010 Thanks that worked fine i made a new variable:$test = "$path/$file";that worked just fine with the function, thanks, though i do feel dumb now. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.