diff --git a/.idea/sonarlint/issuestore/4/3/43dcb35f966f0fa054ba7993783bf64ca2be218c b/.idea/sonarlint/issuestore/4/3/43dcb35f966f0fa054ba7993783bf64ca2be218c index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..7521a9c188aefafc4a009e15922443e00d7b41d2 100644 --- a/.idea/sonarlint/issuestore/4/3/43dcb35f966f0fa054ba7993783bf64ca2be218c +++ b/.idea/sonarlint/issuestore/4/3/43dcb35f966f0fa054ba7993783bf64ca2be218c @@ -0,0 +1,3 @@ + +Нphp:S112Э"FDefine and throw a dedicated exception instead of using a generic one.(█ДФТ■ 8ЎЮЬ╘ю1J$47edde45-6969-4470-9c01-b4077dd7b5f4 +Нphp:S112▓"FDefine and throw a dedicated exception instead of using a generic one.(█ДФТ■ 8ЎЮЬ╘ю1J$5eb02a27-89bd-4e34-8e30-b9f86d63a21d \ No newline at end of file diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index ac992d484966f013e0ca42d0e4323df07c5b87a0..2c12538e990fe6b6cc968767f5e2e537ba796c26 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -106,12 +106,13 @@ class HomeController extends AbstractController return $response; } - #[Route('/func9/{fileName}', name: 'func9')] - public function func9(string $fileName): Response // text.txt + #[Route('/readFileLineByLine', name: 'readFileLineByLine')] + public function readFileLineByLine(Request $request, FileUploader $fileUploader): Response // text.txt { - $filePath = $this->getParameter('kernel.project_dir') . "/public/files/" . $fileName; + $file = $request->files->get('file'); + $fileName = $fileUploader->upload($file); $text = ""; - foreach ($this->functions->readFileLineByLine($filePath) as $line) { + foreach ($this->functions->readFileLineByLine($fileName) as $line) { $text .= $line; } $response = new JsonResponse($text);