我有以下用于文件下载的脚本。
function download(){
$this->file = $this->getFile();
if($this->filesize <= 0 || $this->filesize == null){
echo $this->filesize;
} else {
set_time_limit(0);
header('Content-Description: File Transfer');
header('Content-type:'.$this->contenttype);
header('Content-Disposition: attachment; filename='.$this->filename.'.'.$this->extension);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
ob_end_clean();
readfile('/upload/'.$this->fileUid.'.'.$this->extension);
}
die();
}
当我尝试下载小尺寸(以 Kbs 为单位)的文件时,文件下载成功,但如果文件大小较大,即大于 1MB,则文件无法正确下载,下载的文件大小以 Kbs 为单位,文件不开要么。任何人都可以在这方面帮助我,我试过ob_end_clean()
但没有奏效。请帮助我。问候,