VIDEO SAVE API 2

This commit is contained in:
Velz2020 2020-06-02 11:31:22 +05:30
parent fa66efe6c8
commit c16b2ae5d7

View File

@ -9251,12 +9251,16 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
public function saveCusVideo_post() public function saveCusVideo_post()
{ {
$records = $this->post('records'); $records = json_decode($this->post('records'),true);
//$this->post('records');
$id = null; $id = null;
log_message('ERROR',print_r($records));
if(!empty($_FILES['video_file']))
{
$pd_master_details = $this->PD_Model->getPDMasterDetails($records['pd_id']); $pd_master_details = $this->PD_Model->getPDMasterDetails($records['pd_id']);
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id']; $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
$key = 'pd'.$records['pd_id'].'/video/'.$records['filename']; $key = 'pd'.$records['pd_id'].'/video/'.$records['filename'];
//print_r($pd_master_details);//die();
//$temp_file = XLPATH.'/pd_reports/'.$records['pd_id'].'/temp.txt'; //$temp_file = XLPATH.'/pd_reports/'.$records['pd_id'].'/temp.txt';
$sourcefile = $_FILES['video_file']['tmp_name']; $sourcefile = $_FILES['video_file']['tmp_name'];
@ -9264,7 +9268,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
// fwrite($current_file, $records['video_blob']); // fwrite($current_file, $records['video_blob']);
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$temp_file); $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$temp_file);
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
print_r($s3result);
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
{ {
log_message('ERROR','###PDVIDEO stored in S3'.$records['pd_id']); log_message('ERROR','###PDVIDEO stored in S3'.$records['pd_id']);
@ -9289,6 +9293,14 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
} }
} }
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'No Image found to upload';
$this->response($data,REST_Controller::HTTP_OK);
}
}
} }