Php opendir code problem?

Jake

New member
I get an error message whenever I put the code on my website. The point of the code is to show all of the files in a directory and have a download link next to them.

Here is the code:

<?php
if ($handle = opendir('./mp3/')) {
while (false !== ($file = readdir($handle))) {
if ($file != "./mp3/" && $file != "..") {
echo "$file\n<a href="$file\n">Download</a><br />";
}
}
closedir($handle);
}
?>


Here is the error message:

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /www/zxq.net/t/p/m/tpmac/htdocs/dispmp.php on line 16
 
Back
Top