Welcome Guest, Not a member yet? Register   Sign In
I want doc file upload validation in CI 3.0

File type not validating 

Please help me.


here is the code 

PHP Code:
 if (!empty($_FILES['cv']['name'])) {
                   $config'upload_path' ] = './uploads/cv/';
                   $config'allowed_types' ] = 'doc|docx';
                   $config'max_size' ]= "1000KB";
                   $config'encrypt_name' ] = TRUE;
                   $this->upload->initialize$config );
                   $this->load->library('upload'$config );

                   //$this->form_validation->set_rules('userfile', 'Document', 'required');

                   if ($this->upload->do_upload('cv') ) {

                       $file $this->upload->data();
                       @unlink"uploads/".$old_cv );
                       @unlink"uploads/thumbs/".$old_cv );

                       $data['cv'] =$file['file_name'];
                       $data['cv'] = $old_cv;
                       $this->session->set_flashdata('msg','<div class="alert alert-danger">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                <i class="fa fa-exclamation-triangle"></i> '


Wrong forum. You are asking about CI3 in the CI4 forums, and you'll never get the right answer there. I'm moving it. Smile

Theme © iAndrew 2016 - Forum software by © MyBB