public function addAction() { if ($this->getPostData()) { $news = $this->getPostData(); $news['img'] = "img/news/" . $_FILES['image']['name']; $path = 'img/news/' . $_FILES['image']['name']; // Đường dẫn chưa file upload move_uploaded_file($_FILES['image']['tmp_name'], $path); //end img upload $news['slug'] = $this->app['slugify']->slugify($news['name']); $postID = News::insertNews($news); News::add_tag($postID, $news['tag']); return $this->redirect('viewnews'); } return $this->render('admin/addnews.html.twig'); }