Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require('classes/autoloader.php');
- $flash = new \Library\FlashMessage();
- $common = new \Library\CommonFunction();
- $check_document = new \Model\CheckDocumentModel();
- if (isset($_POST['add_chk_doc'])) {
- $filecontent = $_FILES['chk_doc_image']['name'];
- $dividefile = explode(".", $filecontent);
- $totaldivdedcontent = (sizeof($dividefile) - 1);
- $extension = $dividefile[$totaldivdedcontent];
- if ($_FILES['chk_doc_image']['size'] == "0") {
- $flash->setMessage(array(
- "type" => "danger",
- "message" => "Seems you have not selected any file. Please try again"
- ));
- $common->redirect_to_page(BASE_PATH . 'check_document_add.php');
- }
- elseif ($extension != 'jpg' && $extension != 'jpeg' && $extension != 'png') {
- $flash->setMessage(array(
- "type" => "danger",
- "message" => "Imported file in Invalid. Please check if the uploaded file is Image."
- ));
- $common->redirect_to_page(BASE_PATH . 'check_document.php');
- }
- else {
- $uniqid = date("YmdHis");
- $newfilename = $uniqid . "_chk_doc." . $extension;
- $upload_path = "upload/" . $newfilename;
- $move = move_uploaded_file($_FILES['chk_doc_image']['tmp_name'], $upload_path);
- }
- $ca_code = 'LAN-CDOC' . '-' . rand(0, 9999);
- $doc_check = implode(",",$_POST["chk_status"]);
- $parameter = array(
- "chk_doc_code" => $ca_code,
- "batch_code" => $_POST['batch_no'],
- "student_code" => $_POST['student_no'],
- "doc_name" =>$_POST['doc_name'],
- "chk_status"=>$doc_check,
- "chk_by" =>$_POST['chk_by'],
- "status" => $_POST['status'],
- "chk_doc_image" =>$newfilename
- );
- $result = $check_document->checkDocumentAdd($parameter);
- if ($result) {
- $flash->setMessage(array(
- "type" => "success",
- "message" => "Check Document Successfully Completed"
- ));
- } else {
- $flash->setMessage(array(
- "type" => "danger",
- "message" => "Check Document Failed!!!"
- ));
- }
- $common->redirect_to_page(BASE_PATH . 'check_document.php');
- } else {
- $flash->setMessage(array(
- "type" => "danger",
- "message" => "Check Document Data Failed!!!"
- ));
- $common->redirect_to_page(BASE_PATH . 'check_document.php');
- }
Add Comment
Please, Sign In to add comment