下载的zip文件包含其中的另一个zip文件,但不应该(PHP)

时间:2014-03-21 20:47:49

标签: php

我创建了一个在非Web可访问目录中创建的压缩日志文件。

我可以打开拉链,看起来很完美。仅包含foo.log文件条目。

但是,当我下载zip文件时,zip中包含另一个zip文件,其中包含foo.log条目。

使用此代码下载:

$ file是zip文件的名称,即basename($ full_path_to_zip)

147         header('Content-Description: File Transfer');
148         header('Content-Type: application/octet-stream');
149         header('Content-Type: application/zip');
150         header("Content-disposition: attachment; filename=\"$file\"");
151         header('Expires: 0');
152         header('Cache-Control: must-revalidate');
153         header('Pragma: public');
154         header('Content-Length: ' . filesize($full_path_to_zip));
155         ob_clean();
156         flush();
157         readfile($full_path_to_zip);
158         exit();

147 header('Content-Description: File Transfer'); 148 header('Content-Type: application/octet-stream'); 149 header('Content-Type: application/zip'); 150 header("Content-disposition: attachment; filename=\"$file\""); 151 header('Expires: 0'); 152 header('Cache-Control: must-revalidate'); 153 header('Pragma: public'); 154 header('Content-Length: ' . filesize($full_path_to_zip)); 155 ob_clean(); 156 flush(); 157 readfile($full_path_to_zip); 158 exit();

勇敢吗?

所以下载的zip是target.zip,这就是我看到的

“target.zip” - >包含“目标”(也是拉链) - >包含“foo.log”

我使用引号来表示实际的文件名。

0 个答案:

没有答案