I've created a new Content type with the following properties:
MIME Type: application/zip
File Extension: .zip
Binary: Checked (true)
Then in my resource the Settings have the Content Type selected as "Zip", for above, and the content Disposition as "Attachement" then Class Key as "Document".
My snippet in the resource call is:
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile("$file");
exit;
I get a corrupt downloaded file every time, however if I go to the physical file path on the server I can open it directly. The zip file is being created on they fly, so I can not just make a direct link. Any thoughts?
Cheers