hi guys, i need your help/tips and tricks and foremost an approach on how to start with my little project. I'm trying to build kind of a little ftp browser. all files (and folders) in a specific folder on my ftp-server should get listed underneath. if there is a file and i click it, a download prompt should be triggered. if i click on a folder, the folder should kind of collapse and display the contents. actually almost the same as you can see here: http://filenice.com/demo/ just a lot simpler. without any additional functionality. just listing all files and directories and if i click on a file it should be downloaded.
i've already managed to set up a connection to my ftp-server and all files get listed with this little script below. however i've absolutely no idea how to go on. how can i make a folder clickable (as link), and how can i make a file clickable and prompt a download???
foreach ($contents as $value) {
$line = str_replace($path, "…", $value);
$ext = pathinfo($line, PATHINFO_EXTENSION);
if (strlen($ext) > 0) { //File
print "<a href='$path/$line'>$line</a>";
print "<br>";
//ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)
} else { //Folder
print $line;
print "<br>";
}
}
thank you for your help. regards