Page 1 of 1

need help.. urgent:(

Posted: Sat Dec 26, 2009 1:40 pm
by omerfarooq123
Hi again guyzz.. i wrote this script to open dir on my windows directory but it is not working.. as i am using windows so i can use both forward slash or backward slash but not working.. giving errors.. can some one tell me where is the problem?

Code: Select all

<?
$dir_name = "D:\xampp\htdocs\Opendir";
$dir = opendir($dir_name);
$file_list ="<ul>";
while ($file_name = readdir($dir)){
if (($file_name != "." && ($file_name != "..")){
$file_list .= "<li>$file_name";
}
}
$file_list .= "<ul>";
closedir($dir);
 
 
echo "$dir_name";
echo "$file_list";
 
?>
 

Re: need help.. urgent:(

Posted: Sat Dec 26, 2009 3:27 pm
by mellowman
wait what?

Code: Select all

to open dir on my windows directory
Do you mean on a windows server or an apache server running off windows OS?

And here is a script i wrote before that works and echos out directory's 8O...

Code: Select all

    
<?php 
    $dirname = "THE PATH TO THE FOLDER OR FILE U WANT TO ECHO/"; 
    $dir = opendir($dirname); 
    while(false != ($file = readdir($dir))) { 
  if(($file != ".") and ($file != "..")) 
{ $fileChunks = explode(".", $file); {       
?>
        <br><a href="Google.com"><?php echo $file?></a> <------this is where it echos out 
<?php }}}closedir($dir); ?> 
 

Re: need help.. urgent:(

Posted: Sat Dec 26, 2009 4:48 pm
by omerfarooq123
well thanks but it is also giving me error bro.. i donot know why this script also giving me error

ERROR
Parse error: parse error in D:\xampp\htdocs\lesson9\disp.php on line 4

Re: need help.. urgent:(

Posted: Mon Dec 28, 2009 2:30 am
by mellowman
2 questions

1.Are you sure that the folder you are opening is there and the right CHMOD permissions...?

2.What did you mean '"to open dir on my windows directory"