My problem is that I am wanting a personal file storage website to use between different computers, I have little PHP knowledge, yet more in HTML+CSS. I have found how to list files in a directory on a server, that appear to have a link to download. However, if you proceed to click on this list, it loads a 404 error page. Should it not download? How could I make it to force download the file? Also, all files should be able to be downloaded, not just a certain type (e.g .pdf or .jpg). I have looked extensively on this website and others, but haven't found a working solution.
<body>
<?php
if ($handle = opendir('./uploads/')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$thelist .= '<li><a href="'.$file.'">'.$file.'</a></li>';
}
}
closedir($handle);
}
?>
<h1>List of files:</h1>
<ul><?php echo $thelist; ?></ul>
</body>
Thanks,