I can download pdf files stored outside the web root, like so:
/* DOWNLOADING A FILE FROM A DIRECTORY OUTSIDE THE ROOT.
We'll be outputting a PDF */
header('Content-type: application/pdf');
/* It will be called testpdf.pdf */
header("Content-Disposition: attachment; filename=testpdf.zip");
/* path to outside root directory */
include("/mypath/testpdf.zip");
No problems there - BUT if I try the same thing with a zip file in the following code, I just get an empty file and the error message '...no zip file or part of a spanned zip'.
I've tried changing the application to x-zip and x-zip-compress etc, nothing works:
/* DOWNLOADING A FILE FROM A DIRECTORY OUTSIDE THE ROOT.
We'll be outputting a zip */
header('Content-type: application/zip ');
/* It will be called test.zip */
header("Content-Disposition: attachment; filename=test.zip");
/* path to outside root directory */
include("/mypath/test.zip");