I have the following code
while ($file = $result->fetch_assoc())
{
$name = $file['name'];
$type = $file['type'];
$size = $file['size'];
$path = $file['path'];
$filepath = $path . $name;
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-type: ' . $type);
header( "Content-Disposition: attachment; filename=".basename($name));
header( "Content-Description: File Transfer");
header('Accept-Ranges: bytes');
header('Content-Length: ' . $size);
@readfile($filepath);
}
I get the forced download dialog; however, it seems that the file being sent is basically just the download.php script (the html head tags prior to the php code) I created and not the file from the uploads folder.
My Download link basically looks like
echo "<a href=download.php?id={$uploads['id']}>
{$uploads['title']}<br />
</a>";
Can anyone please give me a hand with this. I've tried everything I can think of.