class Get extends \Magento\Framework\App\Action\Action
.....
public function execute()
{
$fileName = $this->getRequest()->getParam('file');
chdir(BP);
chdir('../download');
$file = getcwd() . "//$fileName";
$this->_logger->info('Downloading..: ' . $file);
$dlName = explode('\\', $file);
$_dl = end($dlName);
$fileName = $_dl;
$this->_logger->info($_dl);
if (file_exists($file)) {
return $this->_downloader->create(
$fileName,
@file_get_contents($file),
$mediapath.'download',
'application/octet-stream'//content type
);
}
}
Im getting this error:
Exception #0 (Magento\Framework\Exception\FileSystemException): Unknown directory type: 'C:/xampp/htdocs/pneumatig-magento2/pub/media/download'
How do I fix that?