Force browser to download a file

Sets correct headers to send file to download instead of displaying it in browser.

php
fork add to bundle source
function force_download($file) { header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"" . basename($file) . "\""); readfile($file); }

usage

load_function('force_download'); force_download('/path/to/file.txt'); // will download it in browser
← how to use this in app?
create log ...inout