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

PHP FTP Can't upload Big FIles
Anyone had any success using FTP to upload a file say 90m?

im using ftp_put and it returns fa

Remove values in array2 from array1
I have two arrays.

Array 1 is where the array key holds various different numbers. For exampl

data type in column definition
Hi,
I create a table with column called "Direction of Travel code ".
The travel codes in t

Simple email form - Newbie
Hello all,

First time poster!

I've been asked to create a simple HTML form that submit

Filling gaps in dates
So i'm doing a query for sales data and my return array looks like this

('date' => '20

Can't find a decent web analytics!!!
I've downloaded and installed Piwik. It's location detection based on IP addresses is fairly inaccur

Syntax Help
I'm trying to make a form that edits a php file which contains config settings. I'm using strings t

pop3 and fsockopen
So I am able to connect to the pop3 server, log in, and check how many messages there are. I am hav

php title problem
Hi,

I am having a problem managing my page title with PHP.

Currently I have my <

please fix the error
What is the error in the below code ???
Line number On/Off | Expand/Contract <?php

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