나는 다음과 같은 방법으로 헤더를 설정합니다. 프로덕션 서버, Apache와 Solaris 및 컴파일 된 PHP에서 파일 크기가 0 인 파일을 얻습니다. 따라서 빈 파일이 생성됩니다.콘텐츠 길이 헤더는 항상 0
구성 매개 변수가 있습니까? 'Content-Length : 1222'를 설정하는 것을 막을 수있는 것이 있습니까?
감사합니다.
코드 :<?php
는 error_reporting (E_ALL); ini_set ('display_errors', '1');
require 'includes/prepend.inc.php';
require __ADMIN_DIR__.'/AdminInfo.php';
$intFile = QApplication::QueryString('fileID');
if($intFile == '') die('Error: missing ID');
$objFile = File::Load($intFile);
$blnRight = false;
$objAdminInfo = new AdminInfo();
if($objAdminInfo->isAdmin()) {
$blnRight = true;
}
else {
$objSecMan = new SecurityManager(
'file:'.$objFile->FileID,
$objAdminInfo->getUserID()
);
$blnRight = $objSecMan->processResource('view');
}
// if the user can modify and or publish, can even view the file
if(!$blnRight) {
$blnRight = $objSecMan->processResource('modify');
if(!$blnRight) {
$blnRight = $objSecMan->processResource('publish');
}
}
//$strPath = __UPLOADS__.DIRECTORY_SEPARATOR.$objFile->FileID;
$strPath = 'subdept.csv';
if (file_exists($strPath) && $blnRight) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$strPath);//$objFile->Filename);
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($strPath));
ob_clean();
flush();
readfile($strPath);
exit;
}
else {
die('Restricted access');
}
?>
나는 그것이 작동 $ strPath하기 전에 코드를 언급, 그래서 피 묻은 프레임 워크에 뭔가해야
. 전체 CMS를 버리고 싶습니다.
감사! 수신 : 전송 인코딩 : 청크 아니요 'Content-Length' 서버를 중지하는 방법을 찾아야합니다. – rtacconi
잘 모르겠지만 젠드 프레임 워크는 청크 인코딩을 사용할지 여부를 결정합니다. 설명서를 확인해야합니다. – Ram
확인해 주셔서 감사합니다. – rtacconi