if ($this->request->getFile('fileBuktiSelisihTxt')) {
$folderLocationKonfirmasi = $this->getFolderKonfirmasiData($idKreditur);
if ($this->validate([
'fileBuktiSelisihTxt' => [
'label' => 'Data Selisih Polis Batal',
'rules' => [
'uploaded[fileBuktiSelisihTxt]',
'ext_in[fileBuktiSelisihTxt,xlsx,xls]',
'mime_in[fileBuktiSelisihTxt,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/msexcel,application/x-msexcel,application/x-ms-excel,application/x-excel,application/x-dos_ms_excel,application/xls,application/x-xls,application/excel,application/download,application/vnd.ms-office,application/msword]',
'max_size[fileBuktiSelisihTxt,1048]',
],
],
])) {
$errors = $this->validation->getErrors();
$arrReturnInvalid = [
'r_status' => false,
'r_data' => [
'status' => 'warning',
'message' => $errors,
],
'r_code' => 400,
'r_message' => 'Bad Request',
];
return json_encode($arrReturnInvalid, JSON_PRETTY_PRINT);
}
$params_file = $this->request->getFile('fileBuktiSelisihTxt');
if ($params_file->isValid() && ! $params_file->hasMoved()) {
$extFile = $params_file->getExtension();
$timeNow = Time::now();
$makeFile = $params_file->getBasename('.' . $extFile) . '_' . $timeNow->getTimestamp() . '_CHECK.' . $extFile;
\log_message('info', 'MASUK SNI APPROVAL');
if ($params_file->move($folderLocationKonfirmasi, $makeFile, true)) {
\log_message('info', 'MASUK SANA APPROVAL');
$postData['fileBuktiSelisih'] = $makeFile;
}
}
}