diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index a4c9cd84..b86538c9 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -9063,6 +9063,7 @@ class PD_Controller extends REST_Controller log_message('ERROR', "bucket key = ".$bucketname); $file_name_wo_extension = explode('.', ($temp_file_name))[0]; log_message('ERROR', "file_name_extension = ".$file_name_wo_extension); + log_message('ERROR', "file_type = ".$_FILES['video_file']['type']); $file_type = explode('/', ($_FILES['video_file']['type']))[1]; log_message('ERROR', "file_type ".$file_type); $folder_to_check = XLPATH . '/' . $file_folder . '/' . $records['pd_id'] . '/videos'; @@ -9076,6 +9077,9 @@ class PD_Controller extends REST_Controller $this->load->library('upload', $config); if ($this->upload->do_upload('video_file')) { $sourcefile = $folder_to_check . '/' . $file_name_wo_extension . '.mp4'; + $filesize = filesize($sourcefile); + $filesize = round($filesize / 1024 / 1024, 1); // megabytes with 1 digit + log_message('ERROR', "The size of your file is $filesize MB."); $bucket_data = array('bucket_name' => $bucketname, 'key' => $key, 'sourcefile' => $sourcefile); $s3result = $this->aws_s3->uploadFileToS3Bucket($bucket_data); if (is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) { @@ -9098,19 +9102,19 @@ class PD_Controller extends REST_Controller else{ $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NOT_FOUND; - $data['msg'] = 'Something Wrong. Try Later!'; + $data['msg'] = 'Something Wrong. Try Later! 1'; $this->response($data, REST_Controller::HTTP_OK); } }else{ $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NOT_FOUND; - $data['msg'] = 'Something Wrong. Try Later!'; + $data['msg'] = 'Something Wrong. Try Later! 2'; $this->response($data, REST_Controller::HTTP_OK); } } else { $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NOT_FOUND; - $data['msg'] = 'Something Wrong. Try Later!'; + $data['msg'] = 'Something Wrong. Try Later! 3'; $this->response($data, REST_Controller::HTTP_OK); } } else {