我有的想下载一个zip文件一些PHP代码...此代码是从一个名为叫download_file.php(非常原始的,我知道)问题命名下载文件
相关功能如下:
function download_clientfile() {
if ($this->download_file === FALSE) {
$this->log->log(sprintf("The download file was not generated."), PEAR_LOG_CRIT);
return;
}
$fsize = filesize($this->download_file);
$path_parts = pathinfo($this->download_file);
$ext = strtolower($path_parts["extension"]);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; file='.$path_parts['basename']);
header('Content-Transfer-Encoding: binary');
header('Expires:0');
header("Cache-control: must-revalidate, post-check=0, pre-check=0");
header('Pragma: public');
header('Content-Length: '.filesize($this->download_file));
ob_clean();
flush();
readfile($this->download_file);
exit;
}
问题:下载的文件是预期的zip文件,但其与T下载他名为'download_file.php'
关于如何通过压缩文件的名称下载它的任何建议。 感谢
谢谢。至少在Firefox和Chrome中,更改为**文件名**而不是**文件**取得了诀窍。 – sunil 2011-03-21 16:07:59