add file preview

This commit is contained in:
2024-12-06 14:03:11 +01:00
parent 9dddf31e56
commit d118467933
9 changed files with 85 additions and 8 deletions

View File

@ -20,6 +20,12 @@ class HomeController extends AbstractController
)]
public function __invoke(FileSystemService $fileSystemService, string $dirs): Response
{
if ($fileSystemService->isFile(substr_replace($dirs, '', -1))) {
return $this->render('file.html.twig', [
'file' => $fileSystemService->getFile((string) substr_replace($dirs, '', -1)),
]);
}
return $this->render('home.html.twig', [
'content' => $fileSystemService->getDirs($dirs),
'fileForm' => $this->createForm(UploadFileForm::class),