add file preview

Reviewed-on: sites/file-explorer#6
This commit is contained in:
2024-12-06 13:04:56 +00:00
parent a574c3a89a
commit 12730b8bcd
10 changed files with 94 additions and 19 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),