Responsive Advertisement

Simple way upload file in codeigniter

Model------->>>
public function sell_merchandise_inquiry(){

if ($this->input->post())
{

  $name = $this->input->post('name');
  $email = $this->input->post('email');
  $city = $this->input->post('city');
  $quantity = $this->input->post('quantity');
  $company = $this->input->post('company');
  $phone = $this->input->post('phone');
  $address = $this->input->post('address');
  $picture = $this->input->post('picture');
  $message = $this->input->post('message');
  $checkdata = $this->input->post('checkdata');

  $this->load->library("email");
$config = array
(
          'mailtype' => 'html',
          'charset'  => 'utf-8',
          'priority' => '1'
        );

$config['upload_path']   = './uploads/';
$config['allowed_types'] = 'mov|mpeg|mp3|avi|mp4|gif|jpg|png|3gp|mpeg';
$dataimg = '';
      $this->load->library('upload', $config);

      if ($this->upload->do_upload('picture'))
      {
    $data =  array('upload_data' => $this->upload->data());
        $dataimg = $data['upload_data']['full_path'];
        $this->email->attach($dataimg);
    }

  $to_email = 'vinaykumar.vismaad@gmail.com';

  if(!empty($email))
          {
                // send mail
                $config = array (
                  'mailtype' => 'html',
                  'charset'  => 'utf-8',
                  'priority' => '1'
                );

                $bodyMsg = '<p style="font-size:14px;font-weight:normal;margin-bottom:10px;margin-top:0;">'.

                $delimeter = $name."<br>".$phone;
                $dataMail = array('name'=>$name,'email'=>$email,'city'=>$city,'company'=>$company,'quantity'=>$quantity,'phone'=>$phone,'address'=>$address,'message'=>$message,'checkdata'=>$checkdata,'thanksMsg'=>'Best regards,', 'delimeter'=> $delimeter);

                $this->email->initialize($config);
                $this->email->from($email);
                $this->email->to($to_email);
                $this->email->subject('sell_merchandise_inquiry');
                $message = $this->load->view('mailtemplate/sell_merchandise_inquiry',$dataMail, TRUE);
                $this->email->message($message);
                $this->email->send();

 

}
$this->load->view('sell_merchandise_inquiry');

}
......NOte; Important for Upload File Code ..


$this->load->library("email");
$config = array
(
          'mailtype' => 'html',
          'charset'  => 'utf-8',
          'priority' => '1'
        );

$config['upload_path']   = './uploads/';
$config['allowed_types'] = 'mov|mpeg|mp3|avi|mp4|gif|jpg|png|3gp|mpeg';
$dataimg = '';
       $this->load->library('upload', $config);

      if ($this->upload->do_upload('picture'))
       {
     $data =  array('upload_data' => $this->upload->data());
        $dataimg = $data['upload_data']['full_path'];
        $this->email->attach($dataimg);
    }

Post a Comment

0 Comments