Full name not shwing in file download
Posted: Sun Jul 22, 2007 5:47 am
I am using this script for file download from database. It downloads fine but shows only the first word of the file name. eg if file name is 'my name.doc', it downloads as 'my.doc'. Please advice what am I doing wrong here...
Code: Select all
<?php
include ('functions.php5');
session_start();
if (isset($_SESSION['valid_user'])) {
if (!$link = dbconn()) {
echo getHeader();
echo '<p>Error1: ' . mysqli_connect_error() . '</p>';
echo getFooter();
exit;
}
$qid = $_GET['qid'];
if (!$resultget = @mysqli_query($link, 'SELECT * FROM `tblupload` WHERE id = \'' . $qid . '\'')) {
echo getHeader();
echo '<p>Error: ' . mysqli_error($link) . '.</p>';
echo getFooter();
mysqli_close($link);
exit;
}
while ($attachlst = mysqli_fetch_assoc($resultget)) {
$name = $attachlst['name'];
$type = $attachlst['type'];
$size = $attachlst['size'];
$content = $attachlst['content'];
};
header('Content-length:' . $size . '');
header('Content-type:' . $type . '');
header('Content-Disposition: attachment; filename=' . $name . '');
echo $content;
}
echo getHeader();
echo '<p> You are not logged in.</p>';
echo '<p class=nav><a href="login.php5">Login</a></p>';
echo getFooter();
exit;
?>