06-19-2015, 04:16 AM
Hallo,
I am using ajax framework in my project ( https://github.com/bcit-ci/CodeIgniter/w...odeIgniter )
I would like to upload an image from a form.
when i put this code in controller with name users image upload correct but i want to put my code in ajax controller in file response/users
my code to upload image.
$config['upload_path'] = './assets/images/avatars/' . $user_id ;
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '800';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$config['file_name'] = 'avatar.png';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
}
else
{
$data = array('upload_data' => $this->upload->data());
}
Any help ???
I am using ajax framework in my project ( https://github.com/bcit-ci/CodeIgniter/w...odeIgniter )
I would like to upload an image from a form.
when i put this code in controller with name users image upload correct but i want to put my code in ajax controller in file response/users
my code to upload image.
$config['upload_path'] = './assets/images/avatars/' . $user_id ;
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '800';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$config['file_name'] = 'avatar.png';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
}
else
{
$data = array('upload_data' => $this->upload->data());
}
Any help ???