WIP: Implement profile editing
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Common;
|
||||
|
||||
use App\Entity\Upload;
|
||||
use App\Service\Upload\UploadHandler;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class DownloadController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly UploadHandler $uploadHandler)
|
||||
{
|
||||
}
|
||||
|
||||
#[Route('/download/{uuid}', name: 'app_common_download')]
|
||||
#[IsGranted('DOWNLOAD', subject: 'upload')]
|
||||
public function index(Upload $upload): Response
|
||||
{
|
||||
$path = $this->uploadHandler->getUploadFilepath($upload);
|
||||
$originalFilename = $upload->getOriginalFilename();
|
||||
|
||||
return $this->file($path, $originalFilename);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user