I am making a file hosting website and am about 95% done but have one issue. When the user clicks their file to download it, the file just appears in the browser. I need to know a way where I can define the $file
variable in the while
loop to be downloadable. The variable that I need to make downloadable is surrounded by asterisks(*)
LOOP:
$directory = 'uploads/' . $_SESSION['user'] . '/';
if ($handle = opendir($directory)) {
echo '<h3>Your files are listed below</h3>';
while ($file = readdir($handle)) {
if ($file != '.' && $file != '..') {
echo '<a href="'.$directory.'/'.$file.'">' . *$file*.'<br>';
}
}
}