Hello,
after following all the instructions the zip file is always 0 bytes.
Only zip archive have this problem. If the downloaded file is .txt or .html, no problem.
Here are my settings :
template downloads : [!FileDownloadPE!]
content type : application/zip
set to attachment
uncacheabe, unsearchable
path : assets/files/downloads/file.zip
MIME : application/zip (or force-download)
phx desactivated
modx 1.0.0
The download is initiated and MIME type is reconized but file is empty. I have tryed many things, thanks in advance for for hints.
EDIT : solved by replacing around line 75 in snippet :
if (file_exists($path)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($path));
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($path));
ob_clean();
flush();
}
if ($read=readfile($path)){
exit;
}else {
echo 'an error has occured, please contact the webmaster';
}
}