line breaks in between fetched file names


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

I have this code:
Code: <?php
Did you know?Explore Trending and Topic pages for more stories like this.
if($dir = opendir('files')){
while (($file = readdir($dir) )!== false){
if ($file !='.' && $file !='..'){
echo '<a href="' . $file . '">' . $file . '</a>';"n";

}
}
closedir($dir);
}
?>
but when it outputs the files from the files folder, it lists them one after another with no spaces etc. How can I make it list one file per line?

e.g.
file_1.doc
file_2.png
file_3.exe

Thanks
No comments posted yet

Your Answer:

Login to answer
176 Like 40 Dislike
Previous forums Next forums
Other forums

Help with setcookie()
Merry Xmas to those on this foruum
Older guy here with some experience but not allot so please be

upload image name with extension using php
hi frds..

<input id="file1" type="file" name="file[]" &a

PHP doesn't send my mail
Hi all, I found this and used it to send mail. Simple contact form with some required fields. The va

php redirecting
i wont open a new thread but i have a question about redirecting....
i wonder why my code doesnt

Why doesn't this work? (SSH2)
This is my script:

Code: <?php
$connection = ssh2_connect('213.251.167.109', 22);

Delete all files in folder except with certain name
I have a script that I want to delete all files in a folder (taken from a database) except for one n

Unable to customise toolbar in FCK
Preloading images
Posting this question here because I am not sure where this should belong.I am building an asp.net a

Not loading image
When this function gets loaded it doesn't load the image just trying to figure out why.

Code:

my two tables
table1 : col1 = topicid , col2 = topic

table2 : col1 = sentid, col2 = sentence

Cod

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash