Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Upload Laporan Pelaksanaan
- public function uploadlaporanpelaksanaan_post()
- {
- $username = trim($this->post('username'));
- $id = $this->post('id');
- if ($username == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Username kosong.',
- ];
- } elseif ($id == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'ID Proposal kosong.',
- ];
- } elseif (empty($_FILES['file_pdf']['name'])) {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'File Laporan Pelaksanaan harus diisi.',
- ];
- } else {
- $jam = time();
- $config['file_name'] = 'Laporan_' . $username . '_' . $jam . '.pdf';
- $config['upload_path'] = './upload_file/laporan/';
- $config['allowed_types'] = 'pdf';
- $config['overwrite'] = true;
- $config['max_size'] = 0;
- $this->load->library('upload', $config);
- if (!$this->upload->do_upload('file_pdf')) {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'File harus PDF.',
- ];
- } else {
- $data = array(
- 'propose_report_file' => $this->upload->file_name,
- 'propose_report_update' => date('Y-m-d H:i:s')
- );
- $this->db->where('propose_id', $id);
- $this->db->update('lemlit_propose', $data);
- $response = [
- 'resp_error' => false,
- 'resp_msg' => 'Laporan Pelaksanaan Berhasil di Simpan.',
- ];
- }
- }
- $this->response($response, 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement