Download Webroot File


#1

Hi guys, I need my page download a file in a folder in webroot to clients computer, I used “withDownload” but didn´t work. Please tell me the best method to do. Thanks


#2

Try this:

$filename = '.htaccess';
$response = $this->response->withFile(
    WWW_ROOT . $filename,
    ['download' => true, 'name' => $filename]
);
return $response;