という名前のzipファイルがありますfilename.zip
。FileZilla を使用して/home/protected
、NearlyFreeSpeech.net がホストする Web サイトのディレクトリにアップロードしました。
最近、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.
先週かそこら前に、私の Web サイトからファイルをダウンロードして、問題なく解凍できました。
ファイルを自分の Web サイトにコピーする前に解凍できます。
後でダウンロードしたファイルのコピーを解凍できません。
ダウンロードを処理する 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 ファイルを正しく解凍できなくなったのはなぜですか?