public function AddNews() { $title = $_POST["newsTitle"]; $text = $_POST["newsText"]; $author = $_POST["newsAuthor"]; if (Input::hasFile("news_picture")) { $file = Input::file("news_picture"); $folder = '/images/'; $destinationPath = public_path() . $folder; $filename = str_random(6) . '_' . $file->getClientOriginalName(); $img_path = $folder . $filename; $uploadSuccess = $file->move($destinationPath, $filename); } News::AddNews($title, $text, $img_path, $author); //redirect to the list with all news }