/**
  *
  * @Route("/submitAvatar", name="upload_avatar", options={"expose"=true})
  * @Method("POST")
  */
 public function uploadAvatarAction(Request $request)
 {
     $base = $request->get("base");
     $file = new File();
     $file->setAlt("png");
     $file->setName("avatar_collab.png");
     $file->setNameShow("avatar_collab.png");
     $this->getUser()->setPicture($file);
     $em = $this->getDoctrine()->getManager();
     $em->persist($file);
     $em->persist($this->getUser());
     $em->flush();
     $id = $file->getId();
     $filename_path = "files/" . $id . ".png";
     $base64_string = str_replace('data:image/png;base64,', '', $base);
     $base64_string = str_replace(' ', '+', $base64_string);
     $base64_string = base64_decode($base64_string);
     file_put_contents("uploads/" . $filename_path, $base64_string);
     return new JsonResponse(array("status" => "ok", "message" => "avatar uploaded"));
 }