0

我有一个名为 .zip 的 zip 文件filename.zip。我使用 FileZilla 将其上传到/home/protected我网站上的目录,该目录由 NearlyFreeSpeech.net 托管。

最近,当我尝试下载 zip 文件并通过unzip filename.zip在终端中运行打开它时,我遇到了这个错误:

Archive:  filename.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of filename.zip or
        filename.zip.zip, and cannot find filename.zip.ZIP, period.

在上周左右之前,我可以从我的网站下载文件并解压缩,没有问题。

我可以在将文件复制到我的网站之前解压缩文件。

我无法解压缩之后下载的文件的副本。

这是处理下载的PHP。

$file = "path/to/file";

if(file_exists($file)){
    $handle = fopen($file, "r");
    header('Content-Description: File Transfer');
    header('Content-Type: application/zip');
    header('Content-Disposition: attachment; filename="'.basename($file).'"');
    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($file));
    ob_clean();
    flush();
    readfile($file);
    fclose($handle);

} else {
    echo('File does not exist');
}

为什么我不能再正确解压缩我下载的 zip 文件?

4

0 回答 0