$target_file = MEDIA_FILES_PATH . "brochure/" . $coursBrochDoc;
     $uploadOk = 1;
     $msg = '';
     $docFileType = pathinfo($target_file, PATHINFO_EXTENSION);
     if ($newDocument != "" && $docFileType != 'doc' && $docFileType != 'docx' && $docFileType != 'pdf' && $docFileType != 'xls' && $docFileType != 'csv') {
         $msg .= "Brochure must be in either of these formats: PDF, DOC, DOCX, XLS, CSV.";
         $uploadOk = 0;
     }
     if ($uploadOk == 1) {
         if ($newDocument != "") {
             move_uploaded_file($_FILES["document"]["tmp_name"], $target_file);
             if ($oldDocument != '' && file_exists(MEDIA_FILES_PATH . "brochure/" . $oldDocument)) {
                 unlink(MEDIA_FILES_PATH . "brochure/" . $oldDocument);
             }
         }
         echo $coursBrochObj->update();
     } else {
         $msg = "Sorry, your course brochure document was not uploaded. ERROR: " . $msg;
         $json = array("status" => 0, "msg" => $msg);
         $dbObj->close();
         //Close Database Connection
         header('Content-type: application/json');
         echo json_encode($json);
     }
 } else {
     $json = array("status" => 0, "msg" => $errorArr);
     $dbObj->close();
     //Close Database Connection
     header('Content-type: application/json');
     echo json_encode($json);
 }