안녕하세요, 다운로드를 강제하는 download.php 파일에 HTTP 헤더가 있습니다.HTTP 헤더 내용 길이 mod_deflate 문제
PHP 코드 :
$file = 'https://www.website.com/downloads/'.$download->stitle.'.zip';
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
다운로드가 문제없이 시작하지만, 부패하고 잘못된 크기 항상?
gzip 압축을 사용하고 있는데, 파일 크기가 603kb이지만 다운로드 윈도우가 2.2kb이므로 다운로드 할 때 content-length가 올바르지 않다고 가정합니다.
htaccess로는 :
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.zip$ no-gzip dont-vary
SetEnvIfNoCase Request_URI download\.php$ no-gzip dont-vary
하지만 다운로드 한 파일이 계속 손상되어 잘못된 크기 (7.7kb) :
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain \
text/html \
text/xml \
text/css \
text/x-component \
application/atom+xml \
application/xml \
application/xhtml+xml \
application/rss+xml \
application/javascript \
application/x-javascript \
application/json \
application/vnd.ms-fontobject \
application/x-font-ttf \
application/x-font-woff \
application/font-woff2 \
application/x-web-app-manifest+json \
image/svg+xml \
image/x-icon
# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>
나는 ZIP 파일과 다운로드 스크립트를 제외하려면 다음을 추가했다. 다운로드 창이 이제 파일 크기를 표시하지 않습니다.
내가 뭘 잘못하고 있니?
편집 : 파일 크기() : I 경고 얻고있다 합계가 https://www.website.com/downloads/free-font-family-poppins.zip
나는 위치에 파일이 정확한 크기와 다운로드 시작으로 이동하기 때문에 파일이 존재하면 실패를, 또한의 사용 권한을 변경 파일과 폴더를 확인하기 위해 권한 문제는 아니지만 여전히 같은 오류가 발생합니다.
[Zip 파일의 다운로드는 손상된 파일을 실행합니다. PHP] (http://stackoverflow.com/questions/2088267/download-of-zip-file-runs-a-corrupted-file-php) – Dez
그 질문에 대한 제안을했지만 운은 시험하지 않았습니다. 수신 한 오류로 내 질문을 수정했습니다. – Ash
경고입니다. 오류가 아닙니다. 이 질문을 확인하십시오 : https://stackoverflow.com/questions/28302953/warning-filesize-stat-failed-for-img-jpg – Dez