[英]showing error(symbols that are difficult to comprehend) while downloading pdf file
i have a writte a code for downloading pdf file. 我写了一个下载pdf文件的代码。 It is properly working on localhost but im getting error while running these code on godaddy where i am hosting. 它在localhost上正常工作,但是在我托管的godaddy上运行这些代码时出现错误。 here is the code 这是代码
<?php
include "connect.inc.php";
if(isset($_GET['id'])) {
$id=$_GET['id'];
$query = "select filename from pdf where id=$id";
$row = mysql_query($query);
if(mysql_num_rows($row)==1){
$query_row=mysql_fetch_assoc($row);
$name=$query_row['filename'];
$path="upload/{$name}";
header('Content-Type: application/pdf');
header('Content-Type: application/octet-stream');
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename={$name}");
header('Content-Length: '. filesize($path));
readfile($path);
}
}
?>
Output: %PDF-1.4 %âãÏÓ 670 0 obj <> endobj xref 670 7 0000000016 00000 n 0000000912 00000 n 0000000977 00000 n 0000001122 00000 n 0000001188 00000 n 0000001305 00000 n 0000000436 00000 n trailer <<97ED15AB8479334F8971D1FF246DC63D>]>> ... 输出:%PDF-1.4%→670 0 obj <> endobj xref 670 7 0000000016 00000 n 0000000912 00000 n 0000000977 00000 n 0000001122 00000 n 0000001188 00000 n 0000001305 00000 n 0000000436 00000 n拖车<< 97ED15AB8479334F8971D1FF246DC63D>] >> ...
You have two Content-Type
headers. 您有两个Content-Type
标头。 Make up your mind. 下定决心
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.