/** * action download * * @param \NetBrothers\Nbdownloader\Domain\Model\Download $download * @return void */ public function downloadAction(\NetBrothers\Nbdownloader\Domain\Model\Download $download) { $counter = intval($download->getCounter()); $counter++; $download->setCounter($counter); $this->downloadRepository->update($download); $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager')->persistAll(); $publicUrl = $download->getSource()->getOriginalResource()->getPublicUrl(); $fileName = $this->downloadRepository->getDownloadName($download, $this->settings); $mimeType = \NetBrothers\Nbdownloader\Helper\GetMimeType::getMimeType($publicUrl); header("Content-type: {$mimeType}"); header("Content-Disposition: attachment; filename=\"{$fileName}\""); ob_clean(); flush(); readfile(PATH_site . $publicUrl); exit; }