line breaks in between fetched file names


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

Hi,

I have this code:
Code: <?php
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

mail with attachment problems
Hi. I have the following code:
Code: else if(file_exists("site".$timp.".zip")

Date help - fetch dates for Mondays between xxx and yyy?
Does anyone know the best way to do this? I have two dates, say:

2010-01-26 and 2010-05-30

writing a screen scraper
Hello,

I'm writing a screen scraper application and want to be able to get absolute addresses

Array to string conversion
Can anyone help me with this?

Notice: Array to string conversion in /home/..../index.php on l

Search in the PHP Files
have to search asterisk(*) in the php code of the php files .
In the html page one text box

Losing 'page' data
I have this code that allows me to update my database. But after updating, I lose the $_GET['page']

I need some help with the IF command...
I have a large number of images in one section of my website with the .jpg format. I'm adding a bun

gather checkbox data from form into email
Hello all,

First, i'd like to thank everyone who responded to my previous posts regarding set

script and html conflict in trying to create a header.
I have an error is occurring because of an html webpage with a "php require" at the top of

Progress bar tracking file downloads
Hey guys, was wondering if there was a way to track how far a file has been downloaded. I know there

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