public function createAction(Request $request)
{
$entity = new AdminFile();
$form = $this->createCreateForm($entity);
$form->handleRequest($request);
if ($form->isValid()) {
$rootDir = $this->getParameter('kernel.root_dir');
$path = $rootDir . '/../web/uploads/files/' . $entity->getPath();
$entity->setSize(StringHelper::formatBytes(filesize($path)));
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
$this->successFlashBag('successful.create');
return $this->redirectToRoute('ojs_admin_file_show', ['id' => $entity->getId()]);
}
return $this->render('OjsAdminBundle:AdminFile:new.html.twig', array('entity' => $entity, 'form' => $form->createView()));
}