apache - PHP: How to access download folder outside root directory? -
this question has answer here:
- download files server php 3 answers
how go creating php script/page allow members/buyers download zipped files(products) stored in download folder located outside root directory? i'm using apache server. please help!
thanks! paul g.
i believe you're trying accomplish (stream existing zip file via php) can done similar answer here: lamp: how create .zip of large files user on fly, without disk/cpu thrashing
slightly modified version of code answer:
// make sure send headers first // content-type important 1 (probably) // header('content-type: application/x-gzip'); $filename = "/path/to/zip.zip"; $fp = fopen($filename, "rb"); // pick bufsize makes happy $bufsize = 8192; $buff = ''; while( !feof($fp) ) { $buff = fread($fp, $bufsize); echo $buff; } pclose($fp);
Comments
Post a Comment