Expense Application
@csrf

Expense Application

@if(request()->isMethod('post')) @php //$filename = $_FILES["myFile"]["name"]; $id = request('id'); $expenseyymm = request('expenseyymm'); $remarks = request('remarks'); $status = request('status'); $empl_cd = Auth::user()->userid; $locn_cd = Auth::user()->proloc; $query = "UPDATE expensehdr SET yymm = '" . $expenseyymm . "',remarks = '" . $remarks . "',status = '$status' ,last_changed_by = '" . $empl_cd . "',last_change_date = '" . date("Y-m-d h:i:s") ."' WHERE empl_cd = '" . $empl_cd . "' and id = '$id'"; //echo $query;die(); $result = DB::UPDATE($query); $expense_attachment = ""; if(!empty($_FILES["myFile"]["name"])) { $targetDirectory = public_path("/atk/web/attachments/expenses/"); $targetFile = $targetDirectory . basename($_FILES["myFile"]["name"]); $expense_attachment = basename($targetFile); $uploadOk = 1; $imageFileType = strtolower(pathinfo($targetFile,PATHINFO_EXTENSION)); if (file_exists($targetFile)) { $uploadOk = 0; } if ($uploadOk == 0) { } else { if (move_uploaded_file($_FILES["myFile"]["tmp_name"], $targetFile)) { } else { } } //echo $expense_attachment;die(); $UpdtDocQry = "UPDATE expensehdr set attachment = '".$expense_attachment."' where empl_cd = '".$empl_cd."' and id = '$id'"; //echo "UPDATE expensehdr set attachment = '".$expense_attachment."' where empl_cd = '".$empl_cd."' and id = '$id'";die(); $UpdtResult = DB::UPDATE($UpdtDocQry); } //echo $status;die(); if($result) { header('Location: Expense_mobile'); exit(); } @endphp @endif