uploadHandler->getResolvedUploadFilepath($upload); if (true === in_array($upload->getType(), [Upload::TYPE_INVOICE, Upload::TYPE_CONTRACT])) { $namer = new DownloadNamer(); $teamer = $upload->getOwner()->getTeamer(); $originalFilename = $namer->nameForTeamer($upload, $teamer); } else { // adopt potentially changed file extension $extension = pathinfo($path, PATHINFO_EXTENSION); $originalFilename = $upload->getOriginalFilename(); if (false === str_ends_with($originalFilename, $extension)) { $originalFilename = $originalFilename.'.'.$extension; } } $inline = (bool) $request->get('inline'); $disposition = $inline ? ResponseHeaderBag::DISPOSITION_INLINE : ResponseHeaderBag::DISPOSITION_ATTACHMENT; // mark file downloaded if applicable if (true === $this->isGranted('ROLE_ADMINISTRATIVE') && false === $inline) { $upload ->setDownloaded() ->setDownloadedBy($this->getUser()->getUserIdentifier()) ; $this->entityManager->flush(); } $this->logger->info('Download file', [ 'file_id' => $upload->getId(), 'file_filename' => $upload->getOriginalFilename(), ]); try { $response = $this->file($path, $originalFilename, $disposition); } catch (FileNotFoundException $e) { throw $this->createNotFoundException('Die Datei wurde nicht gefunden'); } return $response; } }