是个网盘程序,用提取码来下载文件,upload功能正常,但下载的时候出现错误
提示:
Warning: Cannot modify header information - headers already sent by (output started at /home/j/download.php:1) in /home/j/download.php on line 24Warning: Cannot modify header information - headers already sent by (output started at /home/j/download.php:1) in /home/j/download.php on line 25
download.php 文件为(不知为什么,附件不能上传)<?php
require 'config.php';
require 'db.php';
$db=new db;
$db->connect($dbhost, $dbuser, $dbpwd, $dbname);
$Mcncc=$_POST['Mcncc'];
$res=$db->query("select count(*) from list where code='".$Mcncc."'");
$count=$db->fetch_row($res);
if(!$count[0])
{
echo "Have no this Code";
}
else
{
$sql="select file from list where code='".$Mcncc."'";
$res=$db->query($sql);
$tmp=$db->fetch_row($res);
$filename=$uploaddir.$tmp[0];
$realname=substr($tmp[0],0,-5);
$str='Content-Disposition: attachment; filename="'.$realname.'"';
header("Content-type: application/force-download");
header($str);
   readfile($filename);
}
?>
请问,哪里出现了错误?该怎么解决呢?