Welcome Guest, Not a member yet? Register   Sign In
Active record update not working before view ;/
#1

[eluser]amatotax[/eluser]
Hi

I have a problem.

When the form is sent correctly, I am loading view. Before the view Im updating DB.
POST variable 'photo' is not passed and DB wont update ;/ Someone can tell me why?

$this->input->post('photo') is the name of photo like xxx.jpg

Code:
$this->uid = $this->session->userdata('uid'); // user id!
....................
imagejpeg($dst_r, "./uploads/thumbs/thumb_".$this->input->post('photo'), 90);
  $this->seksp_model->update_avatar($this->uid, $this->input->post('photo'));
  $this->load->view('seksp_views/photo/av_success', array('msg' => 'Avatar updated!'));

In the view there is only $msg.

active record:
Code:
public function update_avatar($uid, $avatar)
{
return $this->db->where('id', $uid)->update('photos', array('avatar' => 'thumb_'.$avatar));
}

Thumbail is created, but its updating DB without POST image name. Updating just thumb_

If I delete "loading view" it works fine.

print_r($this->input->post()); returns the photo name!

Any solution?
#2

[eluser]CroNiX[/eluser]
If $photo is a file input, then it doesn't show up in $_POST, it is available in $_FILES.




Theme © iAndrew 2016 - Forum software by © MyBB