Download Webroot File

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

Try this:

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

Hey Guys, I have a similar kind of code but it is not downloading the file. Instead after clicking on the download button, it is not throwing an error or any thing … but it open the blank white page instead of downloading. Please help me with that. thanks in advance