FIX_Notification : ps
This commit is contained in:
parent
c0010f229b
commit
5cb852b513
@ -92,32 +92,35 @@ class Notifications extends BaseController
|
||||
$this->render_page('notifications_form', $data);
|
||||
return;
|
||||
}
|
||||
}else if ($records['type'] == 'document') {
|
||||
if (isset($records['media_doc'])) {
|
||||
if ($doc_details->isValid() && $doc_details->getClientMimeType() === 'image/jpeg') {
|
||||
$doc_name = $doc_details->getName();
|
||||
if ($doc_name !== '') {
|
||||
$doc_details->move($doc_path, $doc_name);
|
||||
$params->media_url = base_url().'public/uploads/'.$doc_name;
|
||||
$params->type = "media";
|
||||
$this->logger->error("Name After Upload: " . $doc_name);
|
||||
}
|
||||
else{
|
||||
$this->logger->error("Err on upload name not Founded ".$records['media_doc']);
|
||||
session()->setFlashdata('error', 'Media Document Missing Please Try again..');
|
||||
$this->render_page('notifications_form', $data);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
session()->setFlashdata('error', 'Please upload a JPEG image.');
|
||||
}elseif ($records['type'] == 'document') {
|
||||
$doc_details = $this->request->getFile('media_doc');
|
||||
$doc_path = APPPATH . '../public/uploads/';
|
||||
|
||||
if (empty($doc_details)) {
|
||||
session()->setFlashdata('error', 'Please select a file to upload.');
|
||||
$this->render_page('notifications_form', $data);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
session()->setFlashdata('error', 'Please upload a JPEG image.');
|
||||
$this->render_page('notifications_form', $data);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$doc_details->isValid() || $doc_details->getClientMimeType() !== 'image/jpeg') {
|
||||
session()->setFlashdata('error', 'Please upload a valid JPEG image.');
|
||||
$this->render_page('notifications_form', $data);
|
||||
return;
|
||||
}
|
||||
|
||||
$doc_name = $doc_details->getName();
|
||||
|
||||
if ($doc_name === '') {
|
||||
$this->logger->error("Err on upload: name not found");
|
||||
session()->setFlashdata('error', 'Document name not found. Please try again.');
|
||||
$this->render_page('notifications_form', $data);
|
||||
return;
|
||||
}
|
||||
|
||||
$doc_details->move($doc_path, $doc_name);
|
||||
$params->media_url = base_url() . 'public/uploads/' . $doc_name;
|
||||
$params->type = "media";
|
||||
$this->logger->error("Name After Upload: " . $doc_name);
|
||||
}else{
|
||||
$params->type = "text" ;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user