apache - PHP: How to access download folder outside root directory? -


this question has answer here:

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

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -