redirectToRoute("app_login"); } public function admin() { return $this->render('Home/admin.html.twig',[ "useheader" => true, "usesidebar" => true, ]); } public function upload(Request $request,$access=null) { // Fichier temporaire uploadé $tmpfile = $request->files->get('upload'); $extention = $tmpfile->getClientOriginalExtension(); // Répertoire de Destination $fs = new Filesystem(); $rootdir = $this->getParameter('kernel.project_dir') . '/public'; $fs->mkdir($rootdir."/uploads/ckeditor"); // Fichier cible $targetName = uniqid().".".$extention; $targetFile = $rootdir."/uploads/ckeditor/".$targetName; $targetUrl = $this->getParameter('appAlias')."uploads/ckeditor/".$targetName; $message = ""; move_uploaded_file($tmpfile,$targetFile); $output["uploaded"]=1; $output["fileName"]=$targetName; $output["url"]=$targetUrl; return new Response(json_encode($output)); } }