2016-07-23 09:00
浏览 63


I am trying to download a file from mysqli database using php for that i have stored file in a folder and file name is stored in the mysqli database.

here is my code...

 $query= mysqli_query($dbo,"SELECT * FROM diff_questions WHERE email = ' $email ' and status= '0' ");

echo "<a href='download.php?file=".$file."&path=".$path." '>Download File</a> ";

and now download.php-

$file = $_GET["file"];
$path = $_GET["path"];
$fullfile = $path.$file;
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=" . Urlencode($file));   
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");            
header("Content-Length: " . Filesize($fullfile));
$fp = fopen($fullfile, "r");
while (!feof($fp))
    echo fread($fp, 65536);

Can someone please tell me what is wrong with code. Its not working . i mean it working file till saving file but its not downloading full file imean afther downloading file size of file is 0kb

1条回答 默认 最新

相关推荐 更多相似问题