This commit is contained in:
2025-07-28 17:38:40 +02:00
parent 7d55ac027a
commit 5762df8df9
12 changed files with 89 additions and 713 deletions

View File

@ -0,0 +1,26 @@
<?php
namespace App\Controller;
use App\Service\FileService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
class FileController extends AbstractController
{
#[Route('/user/file/{id}', name: 'app_files', methods: ['GET'])]
public function browse(int $id, Request $request, FileService $fileService): JsonResponse
{
$relativePath = $request->query->get('path', '');
try {
$files = $fileService->list($id, '');
return $this->json(['files' => $files]);
} catch (\Exception $e) {
return $this->json(['error' => $e->getMessage()], 400);
}
}
}