Exemplo n.º 1
0
 public function actionUploadTerm($trm_id, $cus_kd)
 {
     $arsip = new Arsipterm();
     if ($arsip->load(Yii::$app->request->post())) {
         $data = UploadedFile::getInstances($arsip, 'IMG_BASE64');
         $base64 = self::saveimage(file_get_contents($data[0]->tempName));
         //call function
         $arsip->IMG_BASE64 = $base64;
         $arsip->TERM_ID = $trm_id;
         $arsip->save();
         return $this->redirect(['review', 'id' => $trm_id, 'cus_kd' => $cus_kd]);
     } else {
         return $this->renderAjax('arsip_data_term', ['arsip' => $arsip]);
     }
 }
 public function actionUploadTerm($id, $trm_id)
 {
     $arsip = new Arsipterm();
     if ($arsip->load(Yii::$app->request->post())) {
         $data = UploadedFile::getInstances($arsip, 'IMG_BASE64');
         $base64 = self::saveimage(file_get_contents($data[0]->tempName));
         //call function
         $arsip->IMG_BASE64 = $base64;
         $arsip->TERM_ID = $trm_id;
         $arsip->KD_RIB = $id;
         $arsip->save();
         return $this->redirect(['/purchasing/request-term/edit?kd=' . $arsip->KD_RIB]);
     } else {
         return $this->renderAjax('arsip_term', ['arsip' => $arsip]);
     }
 }