Im trying to allow my user to download the file that they select in my system. The code i have used downloads something but it says failed forbidden. I haven't used directories to store the files but rather stored the file in a longblob data type directly in the database. If someone could please show me how to get it to download successfully I would appreciate it.
<tbody>
<?php
require_once 'dbcon.php';
$query = $conn->query("SELECT fileID, filename, file, dateuploaded from empfiles WHERE eemail = '$_SESSION[login_employee]'");
$count = 1;
while($fetch = $query->fetch_array()){
?>
<tr>
<td style="height:50px;width:100px"><?php echo $count++?></td>
<td style="height:50px;width:200px"><?php echo $fetch['filename']?></td>
<td style="height:50px;width:100px"><?php echo $fetch['dateuploaded']?></td>
?>
</td>
<td colspan="2">
<td>
echo"<a download href=\"file/{$row['file']}\">Download this file</a>";
</td>
</tr>
<?php
}
?>
</tbody>