Tengo este código en php framework codeigniter
estuve gooleando como hacer que solo suba archivos pdf
y doc
. No tuve resultado si me pueden ayudar.
function insert_accountant(){
$page_data = array( // array data that postulate the input fileds
'name' => $this->input->post('name'),
'accountant_number' => $this->input->post('accountant_number'),
'address' => $this->input->post('address'),
'phone' => $this->input->post('phone'),
'marital_status' => $this->input->post('marital_status'),
);
$page_data['file_name'] = $_FILES["file_name"]["name"];
$page_data['email'] = $this->input->post('email');
$check_email = $this->db->get_where('accountant', array('email' => $page_data['email']))->row()->email; // checking if email exists in database
if($check_email != null) {
$this->session->set_flashdata('error_message', get_phrase('email_already_exist'));
redirect(base_url() . 'admin/accountant/', 'refresh');
} else {
$this->db->insert('accountant', $page_data);
$librarian_id = $this->db->insert_id();
move_uploaded_file($_FILES["file_name"]["tmp_name"], "uploads/accountant_image/" . $_FILES["file_name"]["name"]); // upload files
move_uploaded_file($_FILES['userfile']['tmp_name'], 'uploads/accountant_image/' . $librarian_id . '.jpg'); // image with user ID
//$this->email_model->account_opening_email('accountant', $data['email']); //Send email to receipient email adddrress upon account opening
} }