2016-10-04 5 views
0

특정 경로에 .tar.gz 파일이 있습니다. 내가 파일을 구해서 내가 내용을 추출 증명하면PHP 다운로드 우편 번호

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); 
관련 문제