Welcome Guest, Not a member yet? Register   Sign In
Upload file with ajax framework
#1

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 ???
Reply
#2

It is a bit old, but this TUTs might help

http://code.tutsplus.com/tutorials/how-t...-net-21684

Hope that is helpful for you, it helped me.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB