2016-10-04 17 views
0

私は特定のパスに.tar.gzファイルを持っています。私は、ファイルを取得し、私はコンテンツを抽出するために証明したとき、私はのようなエラーが表示さPHPダウンロードZip

header("Cache-Control: public"); 
header("Content-Description: File Transfer"); 
header("Content-Disposition: attachment; filename= " . trim($pathResult)); 
header("Content-Transfer-Encoding: binary"); 
readfile(trim($pathResult)); 

: パスが、私は、ファイルをダウンロードすることができ、このコードでは、変数$pathResult

に記憶されてno archives identifiedなぜ? ?

ファイルの名前は次のとおりです。SelectResult1.tar.gz$pathResult = "C:/wamp/www/prove/WORKSPACE/8c9d081f/SelectResult1.tar.gz"

+0

は、ダウンロードしたファイルを保存し、テキストエディタで開いています。 – nogad

+0

@nogadテキストエディタなぜですか? – mydb

+0

をデバッグのステップとして – nogad

答えて

0

使用は、この:

$file='/path/file.ext'; 
    header("Cache-Control: public"); 
    header("Content-Description: File Transfer"); 
    header("Content-Disposition: attachment; filename=$file"); 
    header("Content-Type: application/zip"); 
    header("Content-Transfer-Encoding: binary"); 

    // read the file from disk 
    readfile($file); 
関連する問題