Commit 28a2514c authored by Mat's avatar Mat

traitement de l'avatar

parent 7517b1b9
......@@ -11,6 +11,7 @@ imports:
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: fr
avatar_directory: "%kernel.project_dir%/web/assets/img/avatar"
framework:
#esi: ~
......
......@@ -43,7 +43,15 @@ class ChatController extends Controller
if ($form->isSubmitted() && $form->isValid())
{
dump($user->getFile()); die;
// traitement de l'avatar, avac un nom unique
$filename = md5(uniqid() . $user->getFile()->getClientOriginalName());
$user->getFile()->move(
$this->getParameter('avatar_directory'),
$filename
);
$user->setAvatar($filename);
$user->setRole(["ROLE_USER"]); // on affecte un rôle
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment