I'm trying to download file from MySQL server, but am not able to do so.
The script executes but it can download only the first 65 KB of the file.
<?php
include('connect.php');
if(isset($_GET['id']))
{
$id = $_GET['id'];
$query = "SELECT * FROM upload WHERE id = '$id'";
$result = mysqli_query($connection,$query) or die(mysql_error());
while($row = mysqli_fetch_assoc($result))
{
$name=$row['name'];
$size=$row['size'];
$type=$row['type'];
$content=$row['content'];
}
header("Content-disposition: attachment; filename=$name");
header("Content-length: $size");
header("Content-type: $type");
echo $content;
} else {
die("No file id given...");
}
unset($_GET['id']);
?>