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