Something like this:
public function add()
{
if (isset($_POST['submit'])) {
$lid = DB::table('dogs')->count();
$lid = $lid + 1;
$file = Input::file('ufile');
$file_name = $file->getClientOriginalName();
$file_ext = $file->getClientOriginalExtension();
$fileInfo = pathinfo($file_name);
$filename = $fileInfo['filename'];
$newname = $filename . $lid . "." . $file_ext;
$destinationPath = ROOTDIR . 'upload/imgdogs/';
//Input::file('ufile')->move($destinationPath, $newname);
$file->move($destinationPath, $newname);
$dogpic = Cln::fixValue($newname);
$dogname = ucfirst(Cln::fixValue($_POST['dogname']));
$sex = ucfirst($_POST['sex']);
$comments = Cln::fixValue($_POST['comments']);
$adopted = (isset($_POST['adopted']) == '1' ? '1' : '0'); ///added
$lastedit = date("Y-m-d H:i:s");
echo "adpt=" . $adopted . "aaa";
if (!isset($error)) {
$postdata = array(
'dogpic' => $dogpic,
'dogname' => $dogname,
'sex' => $sex,
'comments' => $comments,
'adopted' => $adopted,
'lastedit' => $lastedit
);
DB::table('dogs')->insert($postdata);
}
}
$this->layout = 'addtpl';
return View::make('Dogs/Add')->shares('title', 'Dog Add');
}
Done in a different framework, but symphony components, so very similar. Just set the destination path replace ROOTDIR with laravel usage.