}
         if ($file['error'] == 0) {
             $ext = end(explode(".", basename($file['name'])));
             $ext = strtolower($ext);
             $allowed_exe = split(",", ALLOWED_FILETYPES_DOC);
             if (!in_array($ext, $allowed_exe)) {
                 $error[] = format_lang('error', 'file_not_allowed') . " " . basename($file['name']);
             }
         }
     } else {
         $user_id = $session->get_user_id();
         $_SESSION['apply']['cv_selected'] = $cv_selected = $_POST['txt_existed_cv'];
         $cv_setting = new CVSetting();
         $cv_setting->id = $cv_selected;
         $cv_setting->fk_employee_id = $user_id;
         $cv_info = $cv_setting->cv_review_by_employee();
         $cv = array();
         $cv['name'] = $cv_info->cv_title;
         $target = $cv_info->cv_file_path . $cv_info->cv_file_name;
         $cv['tmp_name'] = $target;
         $cv['type'] = $cv_info->cv_file_type;
         $cv['size'] = $cv_info->cv_file_size;
     }
 }
 //end
 if (!$session->get_job_seeker() && ENABLE_SPAM_APPLY_JOB && ENABLE_SPAM_APPLY_JOB == 'Y') {
     if (strtolower($_POST['spam_code']) != strtolower($_SESSION['spam_code']) || (!isset($_SESSION['spam_code']) || $_SESSION['spam_code'] == NULL)) {
         $error[] = get_lang('error', 'spam_wrong_word');
         //$errors[] = "The security code you entered does not match the image. Please try again.";
     }
 }
            $message .= format_lang('cv', 'cv_info_1');
        } else {
            $message .= format_lang('cv', 'cv_info_2');
        }
        $message .= "</div>";
        $message2 = "<div class='success'>CV Visibility is set to public<br />\r\n\t\t\t\t\t\t\t  This CV is currently set to <strong>PUBLIC</strong> and is \r\n\t\t\t\t\t\t\t  <strong>SEARCHABLE</strong> by employers.</div>";
        $session->message($message);
        redirect_to(BASE_URL . "curriculum_vitae/");
    } else {
        $message = "<div class='error'> \r\n\t\t\t\t\t\t\t" . format_lang('following_errors') . "\r\n\t\t\t\t\t\t<ul> <li />";
        $message .= join(" <li /> ", $cv_setting->errors);
        $message .= " </ul> \r\n\t\t\t\t\t\t</div>";
    }
    //if button is not press
} else {
    $cv_details = $cv_setting->cv_review_by_employee();
    if (!$cv_details && !is_array($cv_details)) {
        $session->message("<div class='error'>" . format_lang("error", 'cv_not_found') . "</div>");
        redirect_to(BASE_URL . 'curriculum_vitae/');
        exit;
    }
    $_SESSION['resume']['status'] = $cv_status = strtolower($cv_details->cv_status);
    $_SESSION['resume']['exper'] = $exper = $cv_details->year_experience;
    $_SESSION['resume']['educ'] = $educ = $cv_details->highest_education;
    $_SESSION['resume']['salary'] = $salary = trim($cv_details->salary_range);
    $_SESSION['resume']['availabe'] = $availabe = $cv_details->availability;
    $str_date = $cv_details->start_date;
    if ($cv_details->start_date != "0000-00-00 00:00:00" && $cv_details->start_date != NULL) {
        $_SESSION['resume']['str_date_d'] = $str_date_d = date("d", strtotime($str_date));
        $_SESSION['resume']['str_date_m'] = $str_date_m = date("m", strtotime($str_date));
        $_SESSION['resume']['str_date_y'] = $str_date_y = date("Y", strtotime($str_date));