Мы работаем над Job Scrip. Сталкивается с проблемой при проверке страницы регистрации. Это имеет и на резюме. Нам нужно удалить валидацию из выгрузки резюме. Как удалить валидацию со страницы регистрации только при загрузке резюме. Пожалуйста, помогите нам в этом.
Контроллер находится в codeigniter. Помогите нам, мы застряли в этом.
$this->form_validation->set_message('is_unique', 'The %s is already taken');
if (empty($_FILES['cv_file']['name']))
$this->form_validation->set_rules('cv_file', 'Resume', 'required');
$this->form_validation->set_error_delimiters('<div class="errowbox"><div class="erormsg">', '</div></div>');
if ($this->form_validation->run() === FALSE) {
$data['cpt_code'] = create_ml_captcha();
$this->load->view('jobseeker_signup_view',$data);
return;
}
$current_date = date("Y-m-d H:i:s");
$job_seeker_array = array(
'first_name' => $this->input->post('full_name'),
'email' => $this->input->post('email'),
'password' => $this->input->post('pass'),
'dob' => $this->input->post('dob_year').'-'.$this->input->post('dob_month').'-'.$this->input->post('dob_day'),
'mobile' => $this->input->post('mobile_number'),
'home_phone' => $this->input->post('phone'),
'present_address' => $this->input->post('current_address'),
'country' => $this->input->post('country'),
'city' => $this->input->post('city'),
'nationality' => $this->input->post('nationality'),
'gender' => $this->input->post('gender'),
'ip_address' => $this->input->ip_address(),
'dated' => $current_date
);if (!empty($_FILES['cv_file']['name'])){
//$verification_code = md5(time());
$extention = get_file_extension($_FILES['cv_file']['name']);
$allowed_types = array('doc','docx','pdf','rtf','jpg','txt');
if(!in_array($extention,$allowed_types)){
$data['cpt_code'] = create_ml_captcha();
$data['msg'] = 'This file type is not allowed.';
$this->load->view('jobseeker_signup_view',$data);
return;
}
$seeker_id = $this->job_seekers_model->add_job_seekers($job_seeker_array);
$resume_array = array();
$real_path = realpath(APPPATH . '../public/uploads/candidate/resumes/');
$config['upload_path'] = $real_path;
$config['allowed_types'] = 'doc|docx|pdf|rtf|jpg|txt';
$config['overwrite'] = true;
$config['max_size'] = 6000;
$config['file_name'] = replace_string(' ','-',strtolower($this->input->post('full_name'))).'-'.$seeker_id;
$this->upload->initialize($config);
if (!$this->upload->do_upload('cv_file')){
$this->job_seekers_model->delete_job_seeker($seeker_id);
$data['cpt_code'] = create_ml_captcha();
$data['msg'] = $this->upload->display_errors();
$this->load->view('jobseeker_signup_view',$data);
return;
}
$resume = array('upload_data' => $this->upload->data());
$resume_file_name = $resume['upload_data']['file_name'];
$resume_array = array(
'seeker_ID' => $seeker_id,
'file_name' => $resume_file_name,
'dated' => $current_date,
'is_uploaded_resume' => 'yes'
);
}
Удали это
if (empty($_FILES['cv_file']['name']))
$this->form_validation->set_rules('cv_file', 'Resume', 'required');
Других решений пока нет …