Welcome Guest, Not a member yet? Register   Sign In
error on open_dir function
#1

[eluser]JasmineFlower[/eluser]
In used below code to open & read the folder files

Code:
<div id="openfolderdiv">
&lt;?php  
$dir="../skycad/fence/Fence01";
if ($handle = opendir($dir))
{
     while (false !== ($file = readdir($handle)))
     {  
         if ($file != "." && $file != "..")
         {  
         if(is_dir($dir."/".$file ))
         {
    
                 echo "<ahref=\"../skycad/fence/popup.php?filename=$file \" >".$file."</a> ";        
                 }  
                 }
      }
          closedir($handle);  
  }

?&gt;
</div>

but it displays the below error

Code:
Warning: opendir(../skycad/fence/Fence01/) [function.opendir]: failed to open dir: No such file or directory in /home/content/m/a/y/mayisthree3/html/skycad/fence/wen-demo-fence.php on line 1302

how to solve this...
#2

[eluser]eoinmcg[/eluser]
is this question related in anyway to codeigniter?

you need to read up on directory paths.
if your script resides at
/home/content/m/a/y/mayisthree3/html/skycad/fence/wen-demo-fence.php
and you want to open the dir
/home/content/m/a/y/mayisthree3/html/skycad/fence/Fence01
then $dir should be
Code:
$dir="../Fence01";

alternatively use absolute paths, i.e.
Code:
$dir = $_SERVER['DOCUMENT_ROOT'] . '/path/to/dir';




Theme © iAndrew 2016 - Forum software by © MyBB