Welcome Guest, Not a member yet? Register   Sign In
.doc and .docx file upload
#13

(This post was last modified: 11-09-2016, 03:30 AM by rupamhazra.)

@salain

Here is my controller code below.also i attached the form view.

public function profile_pic()
{
$this->load->view('header');
$error="";
$id=!empty($this->session->userdata('last_insert_id')) ? $this->session->userdata('last_insert_id') : $this->input->post('id');

if($this->input->post('upload'))
{
//echo $id;
//exit();
$config['upload_path']          = './uploads/';
       $config['allowed_types']        = 'gif|jpg|png|doc|pdf|docx';
       $config['max_size']             = 2000;
       $config['max_width']            = 2000;
       $config['max_height']           = 1500;
       $this->load->library('upload', $config);
       $this->upload->initialize($config);
       $error="";
       if ( ! $this->upload->do_upload('userfile') && !$this->input->post('pic'))
       {
           $error = array('error' => $this->upload->display_errors());
           //$this->load->view('profile_pic',$error);
       }
       else
       {
        $data = array('upload_data' => $this->upload->data());
        $post_data=array(
'pic' =>!empty($_FILES["userfile"]["name"])? $_FILES["userfile"]["name"] : $this->input->post('pic')
//'password' => $password
);
        $response=$this->user_model->insert_pic($post_data,$id);
if($response)
{
$this->session->set_flashdata(array('msg' => 'Saved data successsfully','status'=>false));
redirect('usersite');
}
       }
}
$this->load->view('profile_pic',$error);
$this->load->view('footer');
}

Attached Files
.php   profile_pic.php (Size: 875 bytes / Downloads: 127)
.php   mimes.php (Size: 9.82 KB / Downloads: 134)
Reply


Messages In This Thread
.doc and .docx file upload - by rupamhazra - 11-07-2016, 12:31 AM
RE: .doc and .docx file upload - by InsiteFX - 11-07-2016, 05:03 AM
RE: .doc and .docx file upload - by rupamhazra - 11-07-2016, 05:17 AM
RE: .doc and .docx file upload - by InsiteFX - 11-07-2016, 11:25 AM
RE: .doc and .docx file upload - by rupamhazra - 11-07-2016, 10:09 PM
RE: .doc and .docx file upload - by salain - 11-07-2016, 10:47 PM
RE: .doc and .docx file upload - by rupamhazra - 11-07-2016, 11:06 PM
RE: .doc and .docx file upload - by Paradinight - 11-08-2016, 10:51 AM
RE: .doc and .docx file upload - by rupamhazra - 11-08-2016, 09:34 PM
RE: .doc and .docx file upload - by Paradinight - 11-08-2016, 09:50 PM
RE: .doc and .docx file upload - by rupamhazra - 11-08-2016, 10:09 PM
RE: .doc and .docx file upload - by salain - 11-09-2016, 02:24 AM
RE: .doc and .docx file upload - by rupamhazra - 11-09-2016, 03:29 AM
RE: .doc and .docx file upload - by Paradinight - 11-09-2016, 02:07 PM
RE: .doc and .docx file upload - by rupamhazra - 11-09-2016, 09:35 PM
RE: .doc and .docx file upload - by InsiteFX - 11-09-2016, 07:28 AM
RE: .doc and .docx file upload - by rupamhazra - 11-09-2016, 09:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB